Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(775)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabPersistentStore.java

Issue 2149173002: 🎩 Fix NPE in TabPersistentStore when no state file exists (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabPersistentStore.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabPersistentStore.java b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabPersistentStore.java
index 7172413886bf0451197cc0b28b5b27e79c824a5f..ac3d08ba7398092d7dfaab85d5a936d78e6df3e0 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabPersistentStore.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabPersistentStore.java
@@ -384,10 +384,13 @@ public class TabPersistentStore extends TabPersister {
checkAndUpdateMaxTabId();
long timeWaitingForPrefetch = SystemClock.uptimeMillis();
DataInputStream stream = mPrefetchTabListTask.get();
- logExecutionTime("LoadStateInternalPrefetchTime", timeWaitingForPrefetch);
- readSavedStateFile(stream,
- createOnTabStateReadCallback(mTabModelSelector.isIncognitoSelected()), null);
- logExecutionTime("LoadStateInternalTime", time);
+ if (stream != null) {
+ logExecutionTime("LoadStateInternalPrefetchTime", timeWaitingForPrefetch);
+ readSavedStateFile(stream,
+ createOnTabStateReadCallback(mTabModelSelector.isIncognitoSelected()),
+ null);
+ logExecutionTime("LoadStateInternalTime", time);
+ }
} catch (Exception e) {
// Catch generic exception to prevent a corrupted state from crashing app on startup.
Log.d(TAG, "loadState exception: " + e.toString(), e);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698