Bug 710697 - LinkPreference causes a null preference to be sent to Gecko [r=mbrubeck a=android-only]
authorMark Finkle <mfinkle@mozilla.com>
Wed, 14 Dec 2011 16:36:27 -0500
changeset 82592 b0213baf29050f71710bd040e93daa86b517f3f3
parent 82591 99dedca7064e537ed2830b0ffe24ee899a483aaf
child 82593 5ef118dcf1a1455b0b2d0e0f78ad78c0d42fc458
push idunknown
push userunknown
push dateunknown
reviewersmbrubeck, android-only
bugs710697
milestone11.0a1
Bug 710697 - LinkPreference causes a null preference to be sent to Gecko [r=mbrubeck a=android-only]
mobile/android/base/GeckoPreferences.java
--- a/mobile/android/base/GeckoPreferences.java
+++ b/mobile/android/base/GeckoPreferences.java
@@ -191,16 +191,19 @@ public class GeckoPreferences
             }
         } catch (JSONException e) {
             Log.e(LOGTAG, "Problem parsing preferences response: ", e);
         }
     }
 
     // send the Preferences:Set message to Gecko
     public static void setPreference(String pref, Object value) {
+        if (pref == null || pref.length() == 0)
+            return;
+
         try {
             JSONObject jsonPref = new JSONObject();
             jsonPref.put("name", pref);
             if (value instanceof Boolean) {
                 jsonPref.put("type", "bool");
                 jsonPref.put("value", ((Boolean)value).booleanValue());
             }
             else if (value instanceof Integer) {