mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-08-31 06:05:12 +00:00
Fixed NPE because frag.device was null
Why was this starting two RunCommand threads? Exec order is not guaranteed.
This commit is contained in:
@@ -478,16 +478,11 @@ public class DeviceFragment extends Fragment {
|
||||
dev.addPairingCallback(frag.pairingCallback);
|
||||
dev.addPluginsChangedListener(frag.pluginsChangedListener);
|
||||
|
||||
frag.device = dev;
|
||||
frag.device.acceptPairing();
|
||||
|
||||
frag.refreshUI();
|
||||
|
||||
frag.device = dev;
|
||||
}
|
||||
});
|
||||
|
||||
BackgroundService.RunCommand(activity, new BackgroundService.InstanceCallback() {
|
||||
@Override
|
||||
public void onServiceStart(BackgroundService service) {
|
||||
frag.device.acceptPairing();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -502,19 +497,15 @@ public class DeviceFragment extends Fragment {
|
||||
dev.addPairingCallback(frag.pairingCallback);
|
||||
dev.addPluginsChangedListener(frag.pluginsChangedListener);
|
||||
|
||||
frag.refreshUI();
|
||||
|
||||
frag.device = dev;
|
||||
}
|
||||
});
|
||||
BackgroundService.RunCommand(activity, new BackgroundService.InstanceCallback() {
|
||||
@Override
|
||||
public void onServiceStart(BackgroundService service) {
|
||||
|
||||
//Remove listener so buttons don't show for a while before changing the view
|
||||
frag.device.removePluginsChangedListener(frag.pluginsChangedListener);
|
||||
frag.device.removePairingCallback(frag.pairingCallback);
|
||||
frag.device.rejectPairing();
|
||||
activity.onDeviceSelected(null);
|
||||
|
||||
frag.refreshUI();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user