GWT UI: Fix Javascript error on unmarking private on a change

Due to another bug the "Unmark Private" button is shown twice on the change screen. One triggers a DELETE request, the other a POST request. When clicking on the "Unmark Private" button that triggers a POST request the following error occurred in the client:

SEVERE: (TypeError) : Cannot read property 'alert' of null
Class$S171: (TypeError) : Cannot read property 'alert' of null
	at Unknown.$alert(gerrit_ui-0.js)
	at Unknown.onSuccess_158(gerrit_ui-0.js)
	at Unknown.onSuccess_159(gerrit_ui-0.js)
	at Unknown.onSuccess_355(gerrit_ui-0.js)
	at Unknown.onResponseReceived_1(gerrit_ui-0.js)
	at Unknown.fireOnResponseReceived(gerrit_ui-0.js)
	at Unknown.onReadyStateChange(gerrit_ui-0.js)
	at Unknown.<anonymous>(gerrit_ui-0.js)
	at Unknown.apply_9(gerrit_ui-0.js)
	at Unknown.entry0(gerrit_ui-0.js)
	at Unknown.<anonymous>(gerrit_ui-0.js)

Change-Id: I6f34e258113ee55952bd2d6e0f665622c56a162f
Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
Edwin Kempin
2017-05-10 13:23:18 +02:00
parent 540c84296d
commit de7b69d4e3

View File

@@ -41,6 +41,11 @@ class DefaultActions {
@Override
public void onSuccess(JavaScriptObject in) {
UiResult result = asUiResult(in);
if (result == null) {
Gerrit.display(target);
return;
}
if (result.alert() != null) {
Window.alert(result.alert());
}