Skip to content

Commit

Permalink
fix: Small check for command.functionName is not nullptr (#242)
Browse files Browse the repository at this point in the history
There are 16 console commands with command.functionName is nullptr
(Steam 1.9.51). I don't know about script commands but I place the same
check for consistency.
  • Loading branch information
Meridiano authored Feb 15, 2024
1 parent c6b7f11 commit 0d838a6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions CommonLibSF/include/RE/S/Script.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ namespace RE
inline static SCRIPT_FUNCTION* LocateConsoleCommand(const std::string_view a_longName)
{
for (auto& command : GetConsoleCommands()) {
if (std::strlen(command.functionName) == a_longName.size())
if (command.functionName && std::strlen(command.functionName) == a_longName.size())
if (_strnicmp(command.functionName, a_longName.data(), a_longName.size()) == 0)
return std::addressof(command);
}
Expand All @@ -182,7 +182,7 @@ namespace RE
inline static SCRIPT_FUNCTION* LocateScriptCommand(const std::string_view a_longName)
{
for (auto& command : GetScriptCommands()) {
if (std::strlen(command.functionName) == a_longName.size())
if (command.functionName && std::strlen(command.functionName) == a_longName.size())
if (_strnicmp(command.functionName, a_longName.data(), a_longName.size()) == 0)
return std::addressof(command);
}
Expand Down

0 comments on commit 0d838a6

Please sign in to comment.