From ccc3ac415e515e47ccbc72caee0c96444ce959e4 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Wed, 6 Aug 2025 03:14:09 +0800 Subject: [PATCH] :bug: Poll bug fixes --- lib/widgets/poll/poll_submit.dart | 3 ++- lib/widgets/post/post_item.dart | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/widgets/poll/poll_submit.dart b/lib/widgets/poll/poll_submit.dart index b7b56d1..db1d9d4 100644 --- a/lib/widgets/poll/poll_submit.dart +++ b/lib/widgets/poll/poll_submit.dart @@ -333,7 +333,8 @@ class _PollSubmitState extends ConsumerState { switch (q.type) { case SnPollQuestionType.rating: // rating: avg score (double or int) - final avg = (raw['rating'] as num).toDouble(); + final avg = (raw['rating'] as num?)?.toDouble(); + if (avg == null) break; final theme = Theme.of(context); body = Row( mainAxisAlignment: MainAxisAlignment.start, diff --git a/lib/widgets/post/post_item.dart b/lib/widgets/post/post_item.dart index d3b8a98..84ffa90 100644 --- a/lib/widgets/post/post_item.dart +++ b/lib/widgets/post/post_item.dart @@ -571,7 +571,7 @@ class PostItem extends HookConsumerWidget { onSubmit: (_) {}, ).padding(horizontal: 16, vertical: 12), ), - _ => const Placeholder(), + _ => Text('Unable show embed: ${embedData['type']}'), }, )), if (isShowReference)