Skip to content

Commit 064b10a

Browse files
committed
Ruby: Handle missing gemspec in model query
1 parent 9dcc424 commit 064b10a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ruby/ql/src/utils/modeleditor/ModelEditor.qll

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,11 @@ class Endpoint extends DataFlow::MethodNode {
4040
*/
4141
bindingset[this]
4242
string getNamespace() {
43-
// The nearest gemspec to this endpoint
43+
// The nearest gemspec to this endpoint, if one exists
4444
result = min(Gem::GemSpec g, int n | gemFileStep(g, this.getFile(), n) | g order by n).getName()
45+
or
46+
not exists(Gem::GemSpec g) and
47+
result = ""
4548
}
4649

4750
/**

0 commit comments

Comments
 (0)