Skip to content

Commit

Permalink
Fix tag array access to be safe
Browse files Browse the repository at this point in the history
  • Loading branch information
tyiu committed Apr 15, 2024
1 parent 0bdf90f commit 5d99f2b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Primal/Common/Nostr/NostrObject+Extra.swift
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ fileprivate func createNostrReplyEvent(_ content: String, post: PrimalFeedPost,
///
/// The tag to the root of the reply chain goes first.
/// The tag to the reply event being responded to goes last.
if let root = post.tags.last(where: { tag in tag[3] == "root" }) {
if let root = post.tags.last(where: { tag in tag[safe: 3] == "root" }) {
allTags.append(root)
allTags.append(["e", post.id, RelayHintManager.instance.getRelayHint(post.id), "reply"])
} else {
Expand Down

0 comments on commit 5d99f2b

Please sign in to comment.