Skip to content

Commit

Permalink
add null check
Browse files Browse the repository at this point in the history
  • Loading branch information
royston thorndycraft authored and michael-r-elp committed Dec 31, 2022
1 parent fb4adad commit 14e4237
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Hooks/MultiplayerUnavailableReasonHook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace MultiplayerCore {

MAKE_HOOK_MATCH(MultiplayerUnavailableReasonMethods_TryGetMultiplayerUnavailableReason, &MultiplayerUnavailableReasonMethods::TryGetMultiplayerUnavailableReason, bool, ::GlobalNamespace::MultiplayerStatusData* data, ByRef<::GlobalNamespace::MultiplayerUnavailableReason> reason)
{
if (il2cpp_utils::AssignableFrom<Models::MpStatusData*>(reinterpret_cast<Il2CppObject*>(data)->klass) && reinterpret_cast<Models::MpStatusData*>(data)->requiredMods.size() > 0) {
if (data != nullptr && il2cpp_utils::AssignableFrom<Models::MpStatusData*>(reinterpret_cast<Il2CppObject*>(data)->klass) && reinterpret_cast<Models::MpStatusData*>(data)->requiredMods.size() > 0) {
const std::unordered_map<std::string, const Mod>& installedMods = Modloader::getMods();
for (auto& requiredMod : reinterpret_cast<Models::MpStatusData*>(data)->requiredMods) {
auto itr = installedMods.find(requiredMod.id);
Expand Down

0 comments on commit 14e4237

Please sign in to comment.