Commit 24cb0c7b authored by Eugene Ostroukhov's avatar Eugene Ostroukhov Committed by Commit Bot

[DevTools] Avoid exception when calling setStriped

SortableDataGrid.create may return null in some cases, subsequent call
to setStriped in such cases results in an exception logged.

Change-Id: I3f125c5747aeeaf54fce6596bd8451e2eb61b124
Reviewed-on: https://chromium-review.googlesource.com/518505Reviewed-by: default avatarDmitry Gozman <dgozman@chromium.org>
Reviewed-by: default avatarAlexei Filippov <alph@chromium.org>
Reviewed-by: default avatarAndrey Kosyakov <caseq@chromium.org>
Commit-Queue: Eugene Ostroukhov <eostroukhov@chromium.org>
Cr-Commit-Position: refs/heads/master@{#475777}
parent 31217030
...@@ -135,10 +135,10 @@ Resources.DatabaseQueryView = class extends UI.VBox { ...@@ -135,10 +135,10 @@ Resources.DatabaseQueryView = class extends UI.VBox {
_queryFinished(query, columnNames, values) { _queryFinished(query, columnNames, values) {
var dataGrid = DataGrid.SortableDataGrid.create(columnNames, values); var dataGrid = DataGrid.SortableDataGrid.create(columnNames, values);
dataGrid.setStriped(true);
var trimmedQuery = query.trim(); var trimmedQuery = query.trim();
if (dataGrid) { if (dataGrid) {
dataGrid.setStriped(true);
dataGrid.renderInline(); dataGrid.renderInline();
this._appendViewQueryResult(trimmedQuery, dataGrid.asWidget()); this._appendViewQueryResult(trimmedQuery, dataGrid.asWidget());
dataGrid.autoSizeColumns(5); dataGrid.autoSizeColumns(5);
......
...@@ -77,13 +77,13 @@ Resources.DatabaseTableView = class extends UI.SimpleView { ...@@ -77,13 +77,13 @@ Resources.DatabaseTableView = class extends UI.SimpleView {
this.element.removeChildren(); this.element.removeChildren();
this._dataGrid = DataGrid.SortableDataGrid.create(columnNames, values); this._dataGrid = DataGrid.SortableDataGrid.create(columnNames, values);
this._dataGrid.setStriped(true);
this._visibleColumnsInput.setVisible(!!this._dataGrid); this._visibleColumnsInput.setVisible(!!this._dataGrid);
if (!this._dataGrid) { if (!this._dataGrid) {
this._emptyWidget = new UI.EmptyWidget(Common.UIString('The “%s”\ntable is empty.', this.tableName)); this._emptyWidget = new UI.EmptyWidget(Common.UIString('The “%s”\ntable is empty.', this.tableName));
this._emptyWidget.show(this.element); this._emptyWidget.show(this.element);
return; return;
} }
this._dataGrid.setStriped(true);
this._dataGrid.asWidget().show(this.element); this._dataGrid.asWidget().show(this.element);
this._dataGrid.autoSizeColumns(5); this._dataGrid.autoSizeColumns(5);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment