Fix runtime error

This commit is contained in:
Alexander Sheiko 2020-12-17 11:56:13 +02:00
parent 5c6a4dcc8d
commit 0ad2a275ea

View file

@ -193,6 +193,7 @@ func parseTimeline(timeline *timeline) ([]*Tweet, string) {
var cursor string var cursor string
var orderedTweets []*Tweet var orderedTweets []*Tweet
if len(timeline.Timeline.Instructions) > 0 {
for _, entry := range timeline.Timeline.Instructions[0].AddEntries.Entries { for _, entry := range timeline.Timeline.Instructions[0].AddEntries.Entries {
if tweet, ok := tweets[entry.Content.Item.Content.Tweet.ID]; ok { if tweet, ok := tweets[entry.Content.Item.Content.Tweet.ID]; ok {
orderedTweets = append(orderedTweets, &tweet) orderedTweets = append(orderedTweets, &tweet)
@ -201,5 +202,6 @@ func parseTimeline(timeline *timeline) ([]*Tweet, string) {
cursor = entry.Content.Operation.Cursor.Value cursor = entry.Content.Operation.Cursor.Value
} }
} }
}
return orderedTweets, cursor return orderedTweets, cursor
} }