Bug 1338086 - Remove useless else blocks in order to reduce complexity in uriloader/exthandler/unix/ r?froydnj draft
authorSylvestre Ledru <sledru@mozilla.com>
Thu, 09 Feb 2017 15:27:10 +0100
changeset 484406 161f8ff90366dc27d50a946c1b09d3fccec71cdc
parent 484405 5d7ff65c7317c64e5ada34aa42624a4be23b4ba1
child 484407 31b7a5ca298864d3f436d82b702c898262e87883
push id45470
push userbmo:sledru@mozilla.com
push dateWed, 15 Feb 2017 08:57:47 +0000
reviewersfroydnj
bugs1338086
milestone54.0a1
Bug 1338086 - Remove useless else blocks in order to reduce complexity in uriloader/exthandler/unix/ r?froydnj MozReview-Commit-ID: HvmyxEwsnrg
uriloader/exthandler/unix/nsOSHelperAppService.cpp
--- a/uriloader/exthandler/unix/nsOSHelperAppService.cpp
+++ b/uriloader/exthandler/unix/nsOSHelperAppService.cpp
@@ -568,17 +568,18 @@ nsOSHelperAppService::GetExtensionsAndDe
             Substring(minorTypeStart,
                       minorTypeEnd).Equals(aMinorType,
                                            nsCaseInsensitiveStringComparator())) {
           // it's a match
           aFileExtensions.Assign(extensions);
           aDescription.Assign(Substring(descriptionStart, descriptionEnd));
           mimeFile->Close();
           return NS_OK;
-        } else if (NS_FAILED(rv)) {
+        }
+        if (NS_FAILED(rv)) {
           LOG(("Failed to parse entry: %s\n", NS_LossyConvertUTF16toASCII(entry).get()));
         }
 
         entry.Truncate();
       }
     }
     if (!more) {
       rv = NS_ERROR_NOT_AVAILABLE;
@@ -1108,21 +1109,21 @@ nsOSHelperAppService::GetHandlerAndDescr
               }
             }
 
 
             if (match) { // we did not fail any test clauses; all is good
               // get out of here
               mailcapFile->Close();
               return NS_OK;
-            } else { // pretend that this match never happened
-              aDescription.Truncate();
-              aMozillaFlags.Truncate();
-              aHandler.Truncate();
             }
+            // pretend that this match never happened
+            aDescription.Truncate();
+            aMozillaFlags.Truncate();
+            aHandler.Truncate();
           }
         }
         // zero out the entry for the next cycle
         entry.Truncate();
       }
     }
     if (!more) {
       rv = NS_ERROR_NOT_AVAILABLE;