Skip to content
Snippets Groups Projects
Commit b1d0e5d4 authored by dg's avatar dg
Browse files

Maybe fixed the particles crash-to-desktop bug

git-svn-id: http://svn.net-core.org/repos/t-engine4@5662 51575b47-30f0-44d4-a5cc-537603b46e54
parent be175e7f
No related branches found
No related tags found
No related merge requests found
......@@ -401,7 +401,8 @@ static int particles_emit(lua_State *L)
lua_getglobal(L, "__fcts");
lua_pushnumber(L, l->generator_ref);
lua_rawget(L, -2);
if (lua_pcall(L, 0, 1, 0))
if (lua_isnil(L, -1)) { printf("Particle emitter error %x (%d) is nil\n", (int)l, l->generator_ref); }
else if (lua_pcall(L, 0, 1, 0))
{
printf("Particle emitter error %x (%d): %s\n", (int)l, l->generator_ref, lua_tostring(L, -1));
lua_pop(L, 1);
......@@ -510,7 +511,11 @@ void thread_particle_run(particle_thread *pt, plist *l)
lua_rawget(L, -2);
lua_pushnumber(L, l->emit_ref);
lua_rawget(L, -3);
if (lua_pcall(L, 1, 0, 0))
if (lua_isnil(L, -1) || lua_isnil(L, -2)) {
printf("L(%x) Particle updater error %x (%d, %d) is nil: %s / %s\n", (int)L, (int)l, l->updator_ref, l->emit_ref, lua_tostring(L, -1), lua_tostring(L, -2));
lua_pop(L, 2);
}
else if (lua_pcall(L, 1, 0, 0))
{
printf("L(%x) Particle updater error %x (%d, %d): %s\n", (int)L, (int)l, l->updator_ref, l->emit_ref, lua_tostring(L, -1));
// ps->i_want_to_die = TRUE;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment