From 568d542df5ef9d7f10fdb96cb1b0b663414dae3e Mon Sep 17 00:00:00 2001 From: Dmitriy Bogdanov Date: Sun, 17 Jul 2016 14:12:33 +0400 Subject: [PATCH] Add try-catch to followed tags obtaining Just in case. --- .../github/dfa/diaspora_android/util/Helpers.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/com/github/dfa/diaspora_android/util/Helpers.java b/app/src/main/java/com/github/dfa/diaspora_android/util/Helpers.java index 987b8207..4e411338 100644 --- a/app/src/main/java/com/github/dfa/diaspora_android/util/Helpers.java +++ b/app/src/main/java/com/github/dfa/diaspora_android/util/Helpers.java @@ -91,12 +91,14 @@ public class Helpers { " if (typeof gon !== 'undefined' && typeof gon.user !== 'undefined') {" + " var followed_tags = document.getElementById(\"followed_tags\");" + " if(followed_tags != null) {" + - " var links = followed_tags.nextElementSibling.children[0].children;" + - " var tags = [];" + - " for(var i = 0; i < links.length - 1; i++) {" + // the last element is "Manage followed tags" link - " tags.push(links[i].innerText.substring(1));" + - " }" + - " gon.user[\"android_app.followed_tags\"] = tags;" + + " try {" + + " var links = followed_tags.nextElementSibling.children[0].children;" + + " var tags = [];" + + " for(var i = 0; i < links.length - 1; i++) {" + // the last element is "Manage followed tags" link + " tags.push(links[i].innerText.substring(1));" + + " }" + + " gon.user[\"android_app.followed_tags\"] = tags;" + + " } catch(e) {}" + " }" + " var userProfile = JSON.stringify(gon.user);" + " AndroidBridge.setUserProfile(userProfile.toString());" +