mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-26 19:03:38 +08:00
check the value of nodeptr in tnode_t::source_range.
Avoids a possible nullptr dereference
This commit is contained in:
parent
d6e2110cdf
commit
1b23e5471d
|
@ -97,7 +97,7 @@ class tnode_t {
|
|||
uint8_t child_count() const { return nodeptr ? nodeptr->child_count : 0; }
|
||||
|
||||
maybe_t<source_range_t> source_range() const {
|
||||
if (nodeptr->source_start == NODE_OFFSET_INVALID) return none();
|
||||
if (!nodeptr || nodeptr->source_start == NODE_OFFSET_INVALID) return none();
|
||||
return source_range_t{nodeptr->source_start, nodeptr->source_length};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user