Bug 1504780 - Prevent crash if GeckoProfile path is not known; r=geckoview-reviewers,snorp
authorPetru Lingurar <petru.lingurar@softvision.ro>
Mon, 26 Nov 2018 19:21:56 +0000
changeset 507436 2859c48a1a810f72032d9d592c63900390e689a0
parent 507435 d2d2b375ea0aa3b0eddb50428c37e901fa7b90d3
child 507437 b078b2df55db814d01c7402587a3dd5c0b6dff36
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgeckoview-reviewers, snorp
bugs1504780
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1504780 - Prevent crash if GeckoProfile path is not known; r=geckoview-reviewers,snorp 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;
                 }
             }
         }