Bug 1504780 - Prevent crash if GeckoProfile path is not known. r=snorp, a=lizzard
authorPetru Lingurar <petru.lingurar@softvision.ro>
Mon, 26 Nov 2018 19:21:56 +0000
changeset 501432 3bebbace6e4a76ba5c158a922b8f8b541a709e30
parent 501431 f744e835c8bf344bcd6f64b4b894a0a4d64a1c1c
child 501433 729dc4b0b006c47a77ce65fd129054962467d6ec
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssnorp, lizzard
bugs1504780
milestone64.0
Bug 1504780 - Prevent crash if GeckoProfile path is not known. r=snorp, a=lizzard In this case the profile name will be null, situation already handled, in which a telemetry ping about the crash will not be sent but the crash can still be reported to crash-stats. Differential Revision: https://phabricator.services.mozilla.com/D12741
mobile/android/base/java/org/mozilla/gecko/CrashReporterActivity.java
--- a/mobile/android/base/java/org/mozilla/gecko/CrashReporterActivity.java
+++ b/mobile/android/base/java/org/mozilla/gecko/CrashReporterActivity.java
@@ -323,27 +323,30 @@ public class CrashReporterActivity exten
         backgroundSendReport();
     }
 
     public void onRestartClick(View v) {  // bound via crash_reporter.xml
         doRestart();
         backgroundSendReport();
     }
 
-    private String getProfileName(@Nullable File profileDir) throws GeckoProfileDirectories.NoMozillaDirectoryException {
+    private @Nullable String getProfileName(@Nullable File profileDir) throws GeckoProfileDirectories.NoMozillaDirectoryException {
         final File mozillaDir = GeckoProfileDirectories.getMozillaDirectory(this);
         final INIParser parser = GeckoProfileDirectories.getProfilesINI(mozillaDir);
         String profileName = null;
 
         if (parser.getSections() != null && profileDir != null) {
             for (Enumeration<INISection> e = parser.getSections().elements(); e.hasMoreElements(); ) {
                 final INISection section = e.nextElement();
                 final String path = section.getStringProperty("Path");
                 final boolean isRelative = (section.getIntProperty("IsRelative") == 1);
 
+                if (path == null) {
+                    continue;
+                }
                 if ((isRelative && path.equals(profileDir.getName())) ||
                     path.equals(profileDir.getPath())) {
                     profileName = section.getStringProperty("Name");
                     break;
                 }
             }
         }