Skip to content

Commit b48107f

Browse files
committed
Added a check for wordArray not nil to the guard statement in insertWordsIntoTrie.
1 parent 1e9ebe4 commit b48107f

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

Trie/Trie/TrieTests/TrieTests.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,8 @@ class TrieTests: XCTestCase {
5151

5252
/// Inserts words into a trie. If the trie is non-empty, don't do anything.
5353
func insertWordsIntoTrie() {
54-
guard trie.count == 0 else {
55-
return
56-
}
57-
for word in self.wordArray! {
54+
guard let wordArray = wordArray, trie.count == 0 else { return }
55+
for word in wordArray {
5856
trie.insert(word: word)
5957
}
6058
}

0 commit comments

Comments
 (0)