[polari/wip/fmuellner/fix-js-warning] 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] mainWindow: Avoid warning when no room was selected previously
- Date: Mon, 11 Mar 2019 01:14:41 +0000 (UTC)
commit 8373cc4a77010189234f8386a1abb782911d6049
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]