Skip to content

Commit 49acd10

Browse files
Fixed: Fix NullPointerException if arguments extra is not passed to FireReceiver
1 parent 267cf61 commit 49acd10

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

app/src/main/java/com/termux/tasker/FireReceiver.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import android.os.Bundle;
88

99
import com.termux.shared.crash.TermuxCrashUtils;
10+
import com.termux.shared.data.DataUtils;
1011
import com.termux.shared.data.IntentUtils;
1112
import com.termux.shared.file.TermuxFileUtils;
1213
import com.termux.shared.file.filesystem.FileType;
@@ -21,6 +22,7 @@
2122
import com.termux.tasker.utils.PluginUtils;
2223
import com.termux.tasker.utils.TaskerPlugin;
2324

25+
import java.util.ArrayList;
2426
import java.util.List;
2527

2628
/**
@@ -165,8 +167,10 @@ public void onReceive(final Context context, final Intent intent) {
165167
// Arguments are split on whitespaces unless quoted with single or double quotes
166168
// Double quotes and backslashes can be escaped with backslashes in arguments surrounded
167169
// with double quotes
168-
List<String> arguments_list = ArgumentTokenizer.tokenize(arguments_string);
169-
executionCommand.arguments = arguments_list.toArray(new String[arguments_list.size()]);
170+
List<String> arguments_list = new ArrayList<>();
171+
if (!DataUtils.isNullOrEmpty(arguments_string))
172+
arguments_list = ArgumentTokenizer.tokenize(arguments_string);
173+
executionCommand.arguments = arguments_list.toArray(new String[0]);
170174

171175

172176
Logger.logVerboseExtended(LOG_TAG, executionCommand.toString());

0 commit comments

Comments
 (0)