Skip to content

Commit e92b8fd

Browse files
milos1290e7mac
andauthored
Fixing a crash when looking up msg with wrong id (#389)
Co-authored-by: Mayank Sanganeria <[email protected]>
1 parent 02c1b06 commit e92b8fd

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

AndroidSDKCore/src/main/java/com/leanplum/internal/LeanplumInternal.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,13 @@ private static int fetchCountDown(ActionContext context, Map<String, Object> mes
287287
if (((BaseActionContext) context).isPreview()) {
288288
return 5;
289289
} else {
290-
Map<String, Object> messageConfig = CollectionUtil.uncheckedCast(messages.get(context.messageId));
290+
// We need to lookup by original message id, to avoid looking up messages with
291+
// added prefix of __held_back__ to message id.
292+
String originalMessageId = context.getOriginalMessageId();
293+
if (originalMessageId == null) {
294+
return 0;
295+
}
296+
Map<String, Object> messageConfig = CollectionUtil.uncheckedCast(messages.get(originalMessageId));
291297
Object countdown = messageConfig.get("countdown");
292298
if (countdown instanceof Number) {
293299
return ((Number) countdown).intValue();

0 commit comments

Comments
 (0)