Fix crash when searching non-table documentation

This commit is contained in:
XeroOl 2024-05-06 10:36:07 -05:00
parent 2d7c8b1ad7
commit 711c225e9c
2 changed files with 3 additions and 1 deletions

View File

@ -68,7 +68,8 @@ find the definition `10`, but if `opts.stop-early?` is set, it would find
(doto opts (tset :searched-through-require true))
(if (= 0 (length stack))
document
(. document.fields (. stack (length stack)))
(and document.fields
(. document.fields (. stack (length stack))))
(search-document self (. document.fields (table.remove stack)) stack opts)))
(λ search-val [self file ast stack opts]

View File

@ -118,6 +118,7 @@ new message handler `msgh`.")
(fn test-crash []
(check "|(local x {:foo \"hello\"}) x.foo" nil)
(check "|\n(local x {:foo \"hello\"}) x.foo" nil)
(check "print.my-cool-real-field|" nil)
nil)
(fn test-multival []