Skip to content

Commit 1678b7a

Browse files
committed
wip; Check if maxId is valid
1 parent 534478a commit 1678b7a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/widgets/topic_list.dart

+5-1
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,10 @@ class _TopicItem extends StatelessWidget {
230230
final isTopicVisibleInStream = store.isTopicVisibleInStream(streamId, topic);
231231
final visibilityIcon = iconDataForTopicVisibilityPolicy(
232232
store.topicVisibilityPolicy(streamId, topic));
233+
final message = store.messages[maxId];
234+
final isMaxIdValid = message is StreamMessage
235+
&& message.streamId == streamId
236+
&& message.topic.isSameAs(topic);
233237

234238
return Material(
235239
color: designVariables.bgMessageRegular,
@@ -242,7 +246,7 @@ class _TopicItem extends StatelessWidget {
242246
onLongPress: () => showTopicActionSheet(context,
243247
channelId: streamId,
244248
topic: topic,
245-
someMessageIdInTopic: maxId),
249+
someMessageIdInTopic: isMaxIdValid ? maxId : null),
246250
splashFactory: NoSplash.splashFactory,
247251
child: Padding(padding: EdgeInsetsDirectional.fromSTEB(28, 8, 12, 8),
248252
child: Row(

0 commit comments

Comments
 (0)