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