[polari/wip/fmuellner/fix-js-warning: 2/2] mainWindow: Avoid warning when no room was selected previously
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari/wip/fmuellner/fix-js-warning: 2/2] mainWindow: Avoid warning when no room was selected previously
- Date: Tue, 12 Mar 2019 00:52:55 +0000 (UTC)
commit 1f4e0496ad432425a196a55dce0e2b9bd3e8f138
Author: Florian Müllner <fmuellner gnome org>
Date: Sat Mar 9 12:06:39 2019 +0100
mainWindow: Avoid warning when no room was selected previously
On startup we first load the previously joined rooms, then select
the last selected one. However the setting for the latter may return
an empty object (when there were no rooms to restore), resulting in
a JS warning about accessing an undefined property.
Add a check to avoid that warning.
https://gitlab.gnome.org/GNOME/polari/merge_requests/100
src/mainWindow.js | 3 +++
1 file changed, 3 insertions(+)
---
diff --git a/src/mainWindow.js b/src/mainWindow.js
index f320657..a64d97a 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -330,6 +330,9 @@ var MainWindow = GObject.registerClass({
for (let prop in selectedRoom)
selectedRoom[prop] = selectedRoom[prop].deep_unpack();
+ if (!selectedRoom.hasOwnProperty('account'))
+ return;
+
let roomId = null;
let account = this._accountsMonitor.lookupAccount(selectedRoom.account);
let channelName = selectedRoom.channel;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]