Message ID | 20250314202943.112109-2-mzamazal@redhat.com |
---|---|
State | New |
Headers | show |
Series |
|
Related | show |
diff --git a/src/apps/common/options.cpp b/src/apps/common/options.cpp index cae193cc..29a5d9c7 100644 --- a/src/apps/common/options.cpp +++ b/src/apps/common/options.cpp @@ -1095,7 +1095,7 @@ OptionsParser::childOption(const Option *parent, Options *options) std::tie(options, error) = childOption(parent->parent, options); /* Propagate the error all the way back up the call stack. */ - if (!error) + if (error) return { options, error }; }
When OptionsParser::childOption encounters an error, it returns nullptr and the corresponding option. The check for a nested parent checks for an error erroneously, leading not only to a wrong behaviour in case there's no error but also to a segmentation error in case of error due to `options' being set to nullptr and accessed later. Signed-off-by: Milan Zamazal <mzamazal@redhat.com> --- src/apps/common/options.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)