From 1d2257fe381df1afc602607b6c584ffd95e9475c Mon Sep 17 00:00:00 2001 From: "Christian (Fuchs) Loosli" Date: Sun, 22 Jan 2017 01:23:44 +0100 Subject: [PATCH] Fix possible bug when using config before opening the plasmoid --- package/contents/code/hue.js | 8 ++++++++ package/contents/ui/configActions.qml | 3 +++ 2 files changed, 11 insertions(+) diff --git a/package/contents/code/hue.js b/package/contents/code/hue.js index fa4e465..4d74a9b 100644 --- a/package/contents/code/hue.js +++ b/package/contents/code/hue.js @@ -62,8 +62,16 @@ function isInitialized () { * @return {bool} True if auth and bridge are set, otherwise false */ function getHueConfigured() { + if(!isInitialized()) { + initHueConfig(); + } + var base = plasmoid.configuration.baseURL var auth = plasmoid.configuration.authToken + if(!base || !auth) { + // something went terribly wrong here + return false; + } if (!base.trim() || !auth.trim()) { // is empty or whitespace return false; diff --git a/package/contents/ui/configActions.qml b/package/contents/ui/configActions.qml index 9587012..637f28e 100644 --- a/package/contents/ui/configActions.qml +++ b/package/contents/ui/configActions.qml @@ -410,6 +410,9 @@ Item { } Component.onCompleted: { + if(!Hue.isInitialized()) { + Hue.initHueConfig(); + } actionListModel.clear(); try {