Handle null from Gerrit#getDiffPreferences()
Change-Id: Ib6500a1cf55e799b5375ec8e92d82354799fafe5
This commit is contained in:
parent
bea876e4e9
commit
42861a8a47
@ -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);
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user