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

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

Dalon
Just popping in
Just popping in
Posts: 11
Joined: Wed Sep 15, 2010 13:55

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

Postby Dalon » Wed Sep 15, 2010 14:01

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.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

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

Postby CrazyEddie » Thu Sep 16, 2010 10:37

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.

Dalon
Just popping in
Just popping in
Posts: 11
Joined: Wed Sep 15, 2010 13:55

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

Postby Dalon » Thu Sep 16, 2010 13:13

Ah, okay,

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


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 18 guests