Skip to content

Commit 0eec198

Browse files
authored
Fix null pointer when performing multiple delayed actions (#559)
1 parent 7990d25 commit 0eec198

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

AndroidSDKCore/src/main/java/com/leanplum/actions/internal/ActionManagerExecution.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,14 @@ private fun ActionManager.askUserAndPresentAction(currentContext: ActionContext)
150150
// if message is delayed, add it to the scheduler to be delayed
151151
// by the amount of seconds, and exit
152152
MessageDisplayChoice.Type.DELAY -> {
153+
val action = currentAction ?: return
153154
Log.d("[ActionManager][${Util.getThread()}]: delaying action: ${currentContext} for ${displayDecision.delaySeconds}s.")
154155
if (displayDecision.delaySeconds > 0) {
155156
// Schedule for delayed time
156-
scheduler.schedule(currentAction, displayDecision.delaySeconds)
157+
scheduler.schedule(action, displayDecision.delaySeconds)
157158
} else {
158159
// Insert in delayed queue
159-
delayedQueue.pushBack(currentAction)
160+
delayedQueue.pushBack(action)
160161
}
161162
currentAction = null
162163
performActions()

0 commit comments

Comments
 (0)