move url loading after layout finishing to prevent crashes.
[enigma2-curlytx.git] / src / CurlyTx.py
index 50b55b0..6ce0efd 100644 (file)
@@ -70,8 +70,11 @@ class CurlyTx(Screen,HelpableScreen):
 
         self.loadHelp()
         self.loadButtons()
+        self.onLayoutFinish.append(self.afterLayout)
+
+    def afterLayout(self):
+        self.setTextFont
         self.loadUrl(config.plugins.CurlyTx.defaultPage.value)
-        self.onLayoutFinish.append(self.setTextFont)
 
     def loadHelp(self):
         self.helpList.append((
@@ -202,7 +205,7 @@ class CurlyTx(Screen,HelpableScreen):
             self["text"].setText(self.pageContent)
             self.pageContent    = None
             self.showingHeaders = False
-        else:
+        elif self.httpGetterFactory.response_headers:
             headers = _("HTTP response headers for") + "\n" + self.currentUrl + "\n\n"
             for (k, v) in self.httpGetterFactory.response_headers.items():
                 headers += k + ": " + ("\n" + k + ": ").join(v) + "\n"