mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-01-20 00:12:45 +08:00
src/function.cpp: Fix possible NULL-dereference
UBSan complained, so let's check.
This commit is contained in:
parent
c7635ed2c0
commit
0770fd1f89
|
@ -251,7 +251,10 @@ bool function_get_definition(const wcstring &name, wcstring &out_definition) {
|
|||
scoped_rlock locker(functions_lock);
|
||||
const function_info_t *func = function_get(name);
|
||||
if (func) {
|
||||
out_definition = func->props->body_node.get_source(func->props->parsed_source->src);
|
||||
auto props = func->props;
|
||||
if (props && props->parsed_source) {
|
||||
out_definition = props->body_node.get_source(props->parsed_source->src);
|
||||
}
|
||||
}
|
||||
return func != NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user