[DevTools] Storage - style clean up - a check of the variable to see if it exists

Issue #102
This commit is contained in:
janekptacijarabaci 2018-04-28 12:27:35 +02:00 • committed by Roy Tam
commit ae2fd72616

View file

@ -482,8 +482,12 @@ StorageUI.prototype = {
* @param {object} See onUpdate docs * @param {object} See onUpdate docs
*/ */
handleChangedItems: function (changed) { handleChangedItems: function (changed) {
if (this.tree.selectedItem) { let selectedItem = this.tree.selectedItem;
let [type, host, db, objectStore] = this.tree.selectedItem; if (!selectedItem) {
return;
}
let [type, host, db, objectStore] = selectedItem;
if (!changed[type] || !changed[type][host] || if (!changed[type] || !changed[type][host] ||
changed[type][host].length == 0) { changed[type][host].length == 0) {
return; return;
@ -500,7 +504,6 @@ StorageUI.prototype = {
} catch (ex) { } catch (ex) {
this.fetchStorageObjects(type, host, changed[type][host], REASON.UPDATE); this.fetchStorageObjects(type, host, changed[type][host], REASON.UPDATE);
} }
}
}, },
/** /**
@ -830,6 +833,7 @@ StorageUI.prototype = {
if (!item) { if (!item) {
return; return;
} }
this.table.clear(); this.table.clear();
this.hideSidebar(); this.hideSidebar();
this.searchBox.value = ""; this.searchBox.value = "";
@ -1136,11 +1140,12 @@ StorageUI.prototype = {
* Handles adding an item from the storage * Handles adding an item from the storage
*/ */
onAddItem: function () { onAddItem: function () {
if (!this.tree.selectedItem) { let selectedItem = this.tree.selectedItem;
if (!selectedItem) {
return; return;
} }
let front = this.getCurrentFront(); let front = this.getCurrentFront();
let [, host] = this.tree.selectedItem; let [, host] = selectedItem;
// Prepare to scroll into view. // Prepare to scroll into view.
this.table.scrollIntoViewOnUpdate = true; this.table.scrollIntoViewOnUpdate = true;