mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
Prevent null string return from causing undefined behavior.
This commit is contained in:
parent
8a4595dc80
commit
0cfcadb7eb
@ -29,7 +29,8 @@
|
|||||||
namespace sol {
|
namespace sol {
|
||||||
namespace detail {
|
namespace detail {
|
||||||
inline int atpanic(lua_State* L) {
|
inline int atpanic(lua_State* L) {
|
||||||
std::string err = lua_tostring(L, -1);
|
const char* message = lua_tostring(L, -1);
|
||||||
|
std::string err = message ? message : "An unexpected error occured and forced the lua state to call atpanic";
|
||||||
throw error(err);
|
throw error(err);
|
||||||
}
|
}
|
||||||
} // detail
|
} // detail
|
||||||
|
Loading…
x
Reference in New Issue
Block a user