summaryrefslogtreecommitdiff
path: root/js/tt-rss.js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2014-03-14 14:05:32 +0400
committerAndrew Dolgov <[email protected]>2014-03-14 14:05:32 +0400
commitdf63125dd7797064f0bbd5f70267c8b5e1fb36c6 (patch)
treecf843192e9738589436ff892478b86987494a9ab /js/tt-rss.js
parentb55aec078c18b3db85d34329be3f01364e383667 (diff)
handle_rpc_json: do not crash if net-alert is somehow unavailable
Diffstat (limited to 'js/tt-rss.js')
-rw-r--r--js/tt-rss.js21
1 files changed, 16 insertions, 5 deletions
diff --git a/js/tt-rss.js b/js/tt-rss.js
index bb23169ec..a66411d11 100644
--- a/js/tt-rss.js
+++ b/js/tt-rss.js
@@ -989,6 +989,12 @@ function handle_rpc_json(transport, scheduled_call) {
try {
var reply = JSON.parse(transport.responseText);
+ var netalert_dijit = dijit.byId("net-alert");
+ var netalert = false;
+
+ if (netalert_dijit)
+ netalert = netalert_dijit.domNode;
+
if (reply) {
var error = reply['error'];
@@ -1035,16 +1041,21 @@ function handle_rpc_json(transport, scheduled_call) {
if (runtime_info)
parse_runtime_info(runtime_info);
- Element.hide(dijit.byId("net-alert").domNode);
+ if (netalert) Element.hide(netalert);
} else {
- //notify_error("Error communicating with server.");
- Element.show(dijit.byId("net-alert").domNode);
+ if (netalert)
+ Element.show(netalert);
+ else
+ notify_error("Communication problem with server.");
}
} catch (e) {
- Element.show(dijit.byId("net-alert").domNode);
- //notify_error("Error communicating with server.");
+ if (netalert)
+ Element.show(netalert);
+ else
+ notify_error("Communication problem with server.");
+
console.log(e);
//exception_error("handle_rpc_json", e, transport);
}