diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/DiffPreferences.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/DiffPreferences.java index 07d45e9ab4..b1f05f81e3 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/DiffPreferences.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/DiffPreferences.java @@ -21,6 +21,9 @@ import com.google.gwt.core.client.JavaScriptObject; public class DiffPreferences extends JavaScriptObject { public static DiffPreferences create(DiffPreferencesInfo in) { + if (in == null) { + in = DiffPreferencesInfo.defaults(); + } DiffPreferences p = createObject().cast(); p.ignoreWhitespace(in.ignoreWhitespace); p.tabSize(in.tabSize); diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/PreferencesBox.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/PreferencesBox.java index a50768db49..455a6437eb 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/PreferencesBox.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/PreferencesBox.java @@ -503,7 +503,7 @@ public class PreferencesBox extends Composite { AccountApi.putDiffPreferences(prefs, new GerritCallback() { @Override public void onSuccess(DiffPreferences result) { - DiffPreferencesInfo p = Gerrit.getDiffPreferences(); + DiffPreferencesInfo p = new DiffPreferencesInfo(); result.copyTo(p); Gerrit.setDiffPreferences(p); }