Handle null from Gerrit#getDiffPreferences()

Change-Id: Ib6500a1cf55e799b5375ec8e92d82354799fafe5
This commit is contained in:
Dave Borowitz 2015-11-04 15:39:46 -05:00
parent bea876e4e9
commit 42861a8a47
2 changed files with 4 additions and 1 deletions

View File

@ -21,6 +21,9 @@ import com.google.gwt.core.client.JavaScriptObject;
public class DiffPreferences extends JavaScriptObject { public class DiffPreferences extends JavaScriptObject {
public static DiffPreferences create(DiffPreferencesInfo in) { public static DiffPreferences create(DiffPreferencesInfo in) {
if (in == null) {
in = DiffPreferencesInfo.defaults();
}
DiffPreferences p = createObject().cast(); DiffPreferences p = createObject().cast();
p.ignoreWhitespace(in.ignoreWhitespace); p.ignoreWhitespace(in.ignoreWhitespace);
p.tabSize(in.tabSize); p.tabSize(in.tabSize);

View File

@ -503,7 +503,7 @@ public class PreferencesBox extends Composite {
AccountApi.putDiffPreferences(prefs, new GerritCallback<DiffPreferences>() { AccountApi.putDiffPreferences(prefs, new GerritCallback<DiffPreferences>() {
@Override @Override
public void onSuccess(DiffPreferences result) { public void onSuccess(DiffPreferences result) {
DiffPreferencesInfo p = Gerrit.getDiffPreferences(); DiffPreferencesInfo p = new DiffPreferencesInfo();
result.copyTo(p); result.copyTo(p);
Gerrit.setDiffPreferences(p); Gerrit.setDiffPreferences(p);
} }