Page 1 of 1

[Suggestion] Crash when passing nil as an argument in lua

Posted: Wed Sep 15, 2010 14:01
by Dalon
Hi!

I have just a little problem. I'm using the latest CEGUI Version 0.7.2 with OGRE Renderer and Lua scripting module.

My game crashed when I called a lua function, telling me that CEGUIBase.dll wanted to read/write (don't know) to / from a NULL Pointer. I used the symbol files and it told me that the error was in ceguistring.cpp. So...

I figured out that this crash occurred, because nil was passed to CEGUI.Logger:getSingleton():logEvent(...);

Isn't that a bit... weak? I mean... it just crashed ^^ Can't it say something or at least make a NULL-check? Okay, you could say: Just insert a

Code: Select all

local errorString = errorMessages[errorCode + 1]
if errorString == nil then
  errorString = "ERROR_UNKNOWN"
end

CEGUI.Logger:getSingleton():logEvent(errorString)


(that's the way how i do it right now!)

Just a little request that it should be more... stable.

Re: [Suggestion] Crash when passing nil as an argument in lua

Posted: Thu Sep 16, 2010 10:37
by CrazyEddie
The generated lua binding does not check types for release builds, for size and performance reasons. You can enable the checks by changing the state of the LUA_SCRIPT_MODULE_SAFE setting in the projects/premake/config.lua file and rebuilding the script module. This said, I believe this setting is missing for non msvc++ users, so I will ensure this setting is added for other platforms in the next release.

CE.

Re: [Suggestion] Crash when passing nil as an argument in lua

Posted: Thu Sep 16, 2010 13:13
by Dalon
Ah, okay,

thanks for the reply. I will try the SAFE-definition ^^