Fix crash in onRequestPermissionsResult due to empty grantResults

In the case when the permission request dialog is displayed and the
device is changing orientation, the callback will be called with empty
grantResults array. The code needs to take this case into account.

Bug: 27237709
Change-Id: I450d365fcdfa308a69265d75391661fa64028734
diff --git a/src/com/android/htmlviewer/HTMLViewerActivity.java b/src/com/android/htmlviewer/HTMLViewerActivity.java
index aca339f..20f2edc 100644
--- a/src/com/android/htmlviewer/HTMLViewerActivity.java
+++ b/src/com/android/htmlviewer/HTMLViewerActivity.java
@@ -108,9 +108,8 @@
         // We only ever request 1 permission, so these arguments should always have the same form.
         assert permissions.length == 1;
         assert Manifest.permission.READ_EXTERNAL_STORAGE.equals(permissions[0]);
-        assert grantResults.length == 1;
 
-        if (PackageManager.PERMISSION_GRANTED == grantResults[0]) {
+        if (grantResults.length == 1 && PackageManager.PERMISSION_GRANTED == grantResults[0]) {
             // Try again now that we have the permission.
             loadUrl();
         } else {