made a string size check to avoid an error for id string non

This commit is contained in:
vishalxl 2022-08-22 12:58:26 +05:30
parent 100ed2dd99
commit b40a6fe000

View File

@ -347,7 +347,8 @@ class Tree {
int latestEventTime = 0;
String latestEventId = "";
for( String k in allChildEventsMap.keys) {
if( k.substring(0, replyToId.length) == replyToId) {
//print("$k $replyToId");
if( k.length >= replyToId.length && k.substring(0, replyToId.length) == replyToId) {
if( ( allChildEventsMap[k]?.e.eventData.createdAt ?? 0) > latestEventTime ) {
latestEventTime = allChildEventsMap[k]?.e.eventData.createdAt ?? 0;
latestEventId = k;