From d10b49c805a8248422e2ad9711371fcf598fa4a7 Mon Sep 17 00:00:00 2001 From: Sirius902 <3645979-Sirius902@users.noreply.gitlab.com> Date: Sat, 7 Aug 2021 13:13:09 -0700 Subject: [PATCH] Fix null dereference --- GoA RAM Non-Rando.lua | 14 +++++++++----- GoA RAM.lua | 14 +++++++++----- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/GoA RAM Non-Rando.lua b/GoA RAM Non-Rando.lua index f8f969c..621b008 100644 --- a/GoA RAM Non-Rando.lua +++ b/GoA RAM Non-Rando.lua @@ -739,13 +739,17 @@ if true then --No Valor, Wisdom, Master, or Final local CurSubmenu if Platform == 0 then CurSubmenu = ReadInt(Menu2) - CurSubmenu = ReadByte(CurSubmenu) + if CurSubmenu ~= 0 then + CurSubmenu = ReadByte(CurSubmenu) + end elseif Platform == 1 then CurSubmenu = ReadLong(Menu2) - if ENGINE_VERSION < 5.0 then - CurSubmenu = ReadByteA(CurSubmenu) - else - CurSubmenu = ReadByte(CurSubmenu,true) + if CurSubmenu ~= 0 then + if ENGINE_VERSION < 5.0 then + CurSubmenu = ReadByteA(CurSubmenu) + else + CurSubmenu = ReadByte(CurSubmenu,true) + end end end if CurSubmenu == 7 and ReadByte(Save+0x36C0)&0x56 == 0x00 then --In Summon menu without Forms diff --git a/GoA RAM.lua b/GoA RAM.lua index 0c238e2..ccb244f 100644 --- a/GoA RAM.lua +++ b/GoA RAM.lua @@ -759,13 +759,17 @@ if true then --No Valor, Wisdom, Master, or Final local CurSubmenu if Platform == 0 then CurSubmenu = ReadInt(Menu2) - CurSubmenu = ReadByte(CurSubmenu) + if CurSubmenu ~= 0 then + CurSubmenu = ReadByte(CurSubmenu) + end elseif Platform == 1 then CurSubmenu = ReadLong(Menu2) - if ENGINE_VERSION < 5.0 then - CurSubmenu = ReadByteA(CurSubmenu) - else - CurSubmenu = ReadByte(CurSubmenu,true) + if CurSubmenu ~= 0 then + if ENGINE_VERSION < 5.0 then + CurSubmenu = ReadByteA(CurSubmenu) + else + CurSubmenu = ReadByte(CurSubmenu,true) + end end end if CurSubmenu == 7 and ReadByte(Save+0x36C0)&0x56 == 0x00 then --In Summon menu without Forms