Skip to content

Commit 39715ab

Browse files
committed
guard against missing or null port parameter
1 parent cfefb6a commit 39715ab

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

android/app/src/main/java/betaflight/configurator/plugin/SocketPlugin.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ public class SocketPlugin extends Plugin {
2424
@PluginMethod
2525
public void connect(PluginCall call) {
2626
String ip = call.getString("ip");
27-
int port = call.getInt("port");
27+
// Use a default value (e.g., -1) to avoid NullPointerException if "port" is missing
28+
int port = call.getInt("port", -1);
2829

2930
// Validate inputs
3031
if (ip == null || ip.isEmpty()) {

0 commit comments

Comments
 (0)