sourcegraph / srclib

srclib is a polyglot code analysis library, built for hackability. It consists of language analysis toolchains (currently for Go and Java, with Python, JavaScript, and Ruby in beta) with a common output format, and a CLI tool for running the analysis.
https://srclib.org
Other
942 stars 62 forks source link

store.defQueryTreeIndex: Prevent possible nil pointer dereference panic. #199

Closed dmitshur closed 9 years ago

dmitshur commented 9 years ago

There are situations where x.mt.t is nil, so doing node, i := x.mt.t.IndexedTraverse([]rune(q)) results in a nil pointer dereference panic.

This is a quick fix to prevent a panic. A proper fix will be to avoid calling getByQuery when the mafsaTable is not built/read.

neelance commented 9 years ago

LGTM