Skip to content

Commit

Permalink
fix: check if cursorView is null
Browse files Browse the repository at this point in the history
  • Loading branch information
Xtr126 committed Feb 25, 2024
1 parent cacde6f commit b15ba77
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app/src/main/java/xtr/keymapper/server/RemoteService.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class RemoteService extends IRemoteService.Stub {
private ActivityObserverService activityObserverService;
String nativeLibraryDir = System.getProperty("java.library.path");
private View cursorView;
private Context context;
private Context context = null;
private int TYPE_SECURE_SYSTEM_OVERLAY;
Handler mHandler = new Handler(Looper.getMainLooper());

Expand Down Expand Up @@ -170,7 +170,8 @@ private boolean addNewDevices(String[] data) {
public void startServer(KeymapProfile profile, KeymapConfig keymapConfig, IRemoteServiceCallback cb, int screenWidth, int screenHeight) throws RemoteException {
if (inputService != null) stopServer();
cb.asBinder().linkToDeath(this::stopServer, 0);
addCursorView();
if (cursorView != null && !keymapConfig.pointerMode.equals(KeymapConfig.POINTER_SYSTEM))
addCursorView();
inputService = new InputService(profile, keymapConfig, cb, screenWidth, screenHeight, cursorView, isWaylandClient);
if (!isWaylandClient) {
inputService.setMouseLock(true);
Expand All @@ -188,7 +189,7 @@ public void stopServer() {
inputService.destroyUinputDev();
inputService = null;
}
removeCursorView();
if (cursorView != null) removeCursorView();
}

private final DeathRecipient mDeathRecipient = () -> mOnKeyEventListener = null;
Expand Down

0 comments on commit b15ba77

Please sign in to comment.