Fix NPE when fileList is null

This fixes the NPE that occurs when fileList is null (such as when a
patchset is loaded directly through the URL).

Change-Id: Ia152eefa850b139aab58375861cb81ace7774e8f
This commit is contained in:
Keunhong Park
2012-07-12 12:53:18 -06:00
parent 2b41c9c739
commit 485c829984

View File

@@ -153,8 +153,6 @@ public abstract class PatchScreen extends Screen implements
idSideB = id.getParentKey(); idSideB = id.getParentKey();
this.patchIndex = patchIndex; this.patchIndex = patchIndex;
createReviewedPanel();
prefs = fileList != null ? fileList.getPreferences() : prefs = fileList != null ? fileList.getPreferences() :
new ListenableAccountDiffPreference(); new ListenableAccountDiffPreference();
if (Gerrit.isSignedIn()) { if (Gerrit.isSignedIn()) {
@@ -168,11 +166,12 @@ public abstract class PatchScreen extends Screen implements
} }
}); });
reviewedPanel = new FlowPanel();
settingsPanel = new PatchScriptSettingsPanel(prefs); settingsPanel = new PatchScriptSettingsPanel(prefs);
} }
private void createReviewedPanel(){ private void populateReviewedPanel(){
reviewedPanel = new FlowPanel(); reviewedPanel.clear();
reviewedCheckBox = new CheckBox(PatchUtil.C.reviewedAnd() + " "); reviewedCheckBox = new CheckBox(PatchUtil.C.reviewedAnd() + " ");
reviewedCheckBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() { reviewedCheckBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
@@ -440,6 +439,7 @@ public abstract class PatchScreen extends Screen implements
final int rpcseq = ++rpcSequence; final int rpcseq = ++rpcSequence;
lastScript = null; lastScript = null;
settingsPanel.setEnabled(false); settingsPanel.setEnabled(false);
populateReviewedPanel();
if (isFirst && fileList != null) { if (isFirst && fileList != null) {
fileList.movePointerTo(patchKey); fileList.movePointerTo(patchKey);
} }