Fix NPE in PatchScreen that causes Not Found errors
The fileList member isn't populated during onLoad until after the
callback is finished. Its pretty clear from the callback 7 lines
below where this "fix" went in that the fileList can be null under
certain conditions, like when the screen is loading from a URL and
not from a dynamic hyperlink within the application.
Only move the pointer on the file list during the first load of
the screen, after the fileList has been populated.
This fixes f7eb2186537b5145dd81b17a43d675d4bb540fb6.
CC: Keunhong Park <keunhong@codeaurora.org>
CC: Martin Fick <mfick@codeaurora.org>
CC: Deniz Türkoglu <deniz@spotify.com>
Change-Id: I87729abdd26ef76c25a1791c9a0763f82290738a
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/PatchScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/PatchScreen.java
index b1a7fec..77d8659 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/PatchScreen.java
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/PatchScreen.java
@@ -298,8 +298,6 @@
protected void onLoad() {
super.onLoad();
- fileList.movePointerTo(patchKey);
-
if (patchSetDetail == null) {
Util.DETAIL_SVC.patchSetDetail(idSideB,
new GerritCallback<PatchSetDetail>() {
@@ -371,6 +369,9 @@
final int rpcseq = ++rpcSequence;
lastScript = null;
settingsPanel.setEnabled(false);
+ if (isFirst && fileList != null) {
+ fileList.movePointerTo(patchKey);
+ }
PatchUtil.DETAIL_SVC.patchScript(patchKey, idSideA, idSideB, //
settingsPanel.getValue(), new ScreenLoadCallback<PatchScript>(this) {
@Override