From ae0a364504b50b23ce98522ba102a48aad31535a Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Sun, 19 Jul 2020 11:41:39 +0200 Subject: [PATCH] Make GetRandomNature CInterface be wrapped in a try, as it can throw. --- CInterface/Library/NatureLibrary.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CInterface/Library/NatureLibrary.cpp b/CInterface/Library/NatureLibrary.cpp index 2ca6bbc..bc7b904 100644 --- a/CInterface/Library/NatureLibrary.cpp +++ b/CInterface/Library/NatureLibrary.cpp @@ -14,8 +14,8 @@ export uint8_t PkmnLib_NatureLibrary_GetNatureByName(NatureLibrary* p, const cha Try(out = p->GetNatureByName(ArbUt::StringView(name)).GetRaw()); } -export const char* PkmnLib_NatureLibrary_GetRandomNatureName(NatureLibrary* p, ArbUt::Random* rand) { - return p->GetRandomNatureName(*rand).c_str(); +export uint8_t PkmnLib_NatureLibrary_GetRandomNatureName(NatureLibrary* p, ArbUt::Random* rand, const char*& out) { + Try(out = p->GetRandomNatureName(*rand).c_str();) } export uint8_t PkmnLib_NatureLibrary_GetNatureName(NatureLibrary* p, const Nature* nature, const char*& out) {