diff --git a/src/main/java/com/nutomic/syncthingandroid/syncthing/SyncthingService.java b/src/main/java/com/nutomic/syncthingandroid/syncthing/SyncthingService.java index 49a2db44..9205bb1c 100644 --- a/src/main/java/com/nutomic/syncthingandroid/syncthing/SyncthingService.java +++ b/src/main/java/com/nutomic/syncthingandroid/syncthing/SyncthingService.java @@ -241,8 +241,11 @@ public class SyncthingService extends Service implements if (mConfig != null) { mCurrentState = State.STARTING; - registerOnWebGuiAvailableListener(mApi); - registerOnWebGuiAvailableListener(mEventProcessor); + + if (mApi != null) + registerOnWebGuiAvailableListener(mApi); + if (mEventProcessor != null) + registerOnWebGuiAvailableListener(mEventProcessor); new PollWebGuiAvailableTaskImpl(getFilesDir() + "/" + HTTPS_CERT_FILE) .execute(mConfig.getWebGuiUrl()); mRunnable = new SyncthingRunnable(this, SyncthingRunnable.Command.main);