From f5aff4d262266aa67387c69da2353cc21cd64e52 Mon Sep 17 00:00:00 2001 From: LucasGGamerM Date: Thu, 21 Sep 2023 07:32:24 -0300 Subject: [PATCH] fix(drafts): fix crash when editing a draft with a poll Fixes #243 --- .../android/ui/viewcontrollers/ComposePollViewController.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mastodon/src/main/java/org/joinmastodon/android/ui/viewcontrollers/ComposePollViewController.java b/mastodon/src/main/java/org/joinmastodon/android/ui/viewcontrollers/ComposePollViewController.java index 52aa0a88f..4b12397da 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/viewcontrollers/ComposePollViewController.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/viewcontrollers/ComposePollViewController.java @@ -134,7 +134,8 @@ public class ComposePollViewController{ DraftPollOption opt=createDraftPollOption(false); opt.edit.setText(eopt.title); } - pollDuration=(int)fragment.editingStatus.poll.expiresAt.minus(fragment.editingStatus.createdAt.toEpochMilli(), ChronoUnit.MILLIS).getEpochSecond(); + if(fragment.editingStatus.poll.expiresAt!=null) + pollDuration=(int)fragment.editingStatus.poll.expiresAt.minus(fragment.editingStatus.createdAt.toEpochMilli(), ChronoUnit.MILLIS).getEpochSecond(); updatePollOptionHints(); pollDurationValue.setText(UiUtils.formatDuration(fragment.getContext(), pollDuration)); pollIsMultipleChoice=fragment.editingStatus.poll.multiple;