mirror of https://github.com/WerWolv/ImHex.git
fix: Segfault when launching ImHex with file arguments (#1501)
d511080814
introduced a regression where
running imhex with arguments (i.e. `imhex blob1.bin blob2.bin`) will
segfault due to a null pointer dereference.
### Implementation description
This patch updates `getSubCommands` to follow the same control flow as
`getFeatures`, where if the function returns a null pointer, it will
return gracefully rather than crash.
This commit is contained in:
parent
ffb324f685
commit
cc97c0e525
|
@ -186,6 +186,8 @@ namespace hex {
|
|||
std::span<SubCommand> Plugin::getSubCommands() const {
|
||||
if (m_functions.getSubCommandsFunction != nullptr) {
|
||||
const auto result = m_functions.getSubCommandsFunction();
|
||||
if (result == nullptr)
|
||||
return { };
|
||||
|
||||
return *static_cast<std::vector<SubCommand>*>(result);
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue