mirror of
https://github.com/syncthing/syncthing-android.git
synced 2024-11-27 06:41:15 +00:00
Fixed crash when closing DeviceFragment early (reported on GPlay)
This commit is contained in:
parent
972f38755a
commit
77c2d4bd55
2 changed files with 4 additions and 3 deletions
|
@ -397,7 +397,7 @@ public class DeviceFragment extends Fragment implements
|
||||||
* Sends the updated device info if in edit mode.
|
* Sends the updated device info if in edit mode.
|
||||||
*/
|
*/
|
||||||
private void updateDevice() {
|
private void updateDevice() {
|
||||||
if (!mIsCreateMode && mDeviceNeedsToUpdate) {
|
if (!mIsCreateMode && mDeviceNeedsToUpdate && mDevice != null) {
|
||||||
mSyncthingService.getApi().editDevice(mDevice, getActivity(), this);
|
mSyncthingService.getApi().editDevice(mDevice, getActivity(), this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ import android.content.ClipboardManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
@ -834,7 +835,7 @@ 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 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).
|
* @param listener for the normalized device ID (may be null).
|
||||||
*/
|
*/
|
||||||
public void editDevice(final Device device, final Activity activity,
|
public void editDevice(@NonNull final Device device, final Activity activity,
|
||||||
final OnDeviceIdNormalizedListener listener) {
|
final OnDeviceIdNormalizedListener listener) {
|
||||||
normalizeDeviceId(device.deviceID,
|
normalizeDeviceId(device.deviceID,
|
||||||
new RestApi.OnDeviceIdNormalizedListener() {
|
new RestApi.OnDeviceIdNormalizedListener() {
|
||||||
|
|
Loading…
Reference in a new issue