diff --git a/src/main/java/com/nutomic/syncthingandroid/fragments/DeviceFragment.java b/src/main/java/com/nutomic/syncthingandroid/fragments/DeviceFragment.java index 6734f3aa..77d23e3a 100644 --- a/src/main/java/com/nutomic/syncthingandroid/fragments/DeviceFragment.java +++ b/src/main/java/com/nutomic/syncthingandroid/fragments/DeviceFragment.java @@ -397,7 +397,7 @@ public class DeviceFragment extends Fragment implements * Sends the updated device info if in edit mode. */ private void updateDevice() { - if (!mIsCreateMode && mDeviceNeedsToUpdate) { + if (!mIsCreateMode && mDeviceNeedsToUpdate && mDevice != null) { mSyncthingService.getApi().editDevice(mDevice, getActivity(), this); } } diff --git a/src/main/java/com/nutomic/syncthingandroid/syncthing/RestApi.java b/src/main/java/com/nutomic/syncthingandroid/syncthing/RestApi.java index f8dc2d3e..af8f31c7 100644 --- a/src/main/java/com/nutomic/syncthingandroid/syncthing/RestApi.java +++ b/src/main/java/com/nutomic/syncthingandroid/syncthing/RestApi.java @@ -7,6 +7,7 @@ import android.content.ClipboardManager; import android.content.Context; import android.content.Intent; import android.os.AsyncTask; +import android.support.annotation.NonNull; import android.text.TextUtils; import android.util.Log; import android.widget.Toast; @@ -834,8 +835,8 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener, * @param device Settings of the device to edit. To create a device, pass a non-existant device ID. * @param listener for the normalized device ID (may be null). */ - public void editDevice(final Device device, final Activity activity, - final OnDeviceIdNormalizedListener listener) { + public void editDevice(@NonNull final Device device, final Activity activity, + final OnDeviceIdNormalizedListener listener) { normalizeDeviceId(device.deviceID, new RestApi.OnDeviceIdNormalizedListener() { @Override