Skip to content

Commit

Permalink
fix: NPE on key commands that to start activity with intent
Browse files Browse the repository at this point in the history
  • Loading branch information
WhiredPlanck committed Jan 30, 2025
1 parent 3d0a48f commit d6c7d6e
Showing 1 changed file with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -208,19 +208,20 @@ class CommonKeyboardActionListener(
}
"commit" -> service.commitText(arg)
"date" -> service.commitText(customFormatDateTime(arg))
"run" ->
service.startActivity(
buildIntentFromArgument(arg)?.apply {
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_NO_HISTORY
},
)
"run" -> {
val intent = buildIntentFromArgument(arg)
if (intent != null) {
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_NO_HISTORY
service.startActivity(intent)
}
}
"share_text" -> service.shareText()
else -> {
service.startActivity(
buildIntentFromAction(action.command, arg)?.apply {
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_NO_HISTORY
},
)
val intent = buildIntentFromAction(action.command, arg)
if (intent != null) {
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_NO_HISTORY
service.startActivity(intent)
}
}
}
}
Expand Down

0 comments on commit d6c7d6e

Please sign in to comment.