diff --git a/extensions/java/xpcom/interfaces/org/mozilla/xpcom/Mozilla.java b/extensions/java/xpcom/interfaces/org/mozilla/xpcom/Mozilla.java index da4810ada0ef..650ac1a7248e 100644 --- a/extensions/java/xpcom/interfaces/org/mozilla/xpcom/Mozilla.java +++ b/extensions/java/xpcom/interfaces/org/mozilla/xpcom/Mozilla.java @@ -339,9 +339,15 @@ public class Mozilla implements IGRE, IXPCOM, IXPCOMError { // get 'section' name, which will be a registry key name String section = (String) sectionsIter.next(); + // Skip over GRE key ("\Software\mozilla.org\GRE") + int gre_len = aKeyName.length(); + if (section.length() <= gre_len) { + continue; + } + // Get the GRE subkey; that is, everything after // "\Software\mozilla.org\GRE\" - String subkeyName = section.substring(aKeyName.length() + 1); + String subkeyName = section.substring(gre_len + 1); // We are only interested in _immediate_ subkeys. We want // "\Software\mozilla.org\GRE\" but not