From aa92d0c62ed62e5b3fa0572015db3c26a017e270 Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 18 Jun 2008 17:38:43 +0000 Subject: [PATCH] added error at get_surface, to prevent crashes --- panda/src/ode/odeWorld.cxx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/panda/src/ode/odeWorld.cxx b/panda/src/ode/odeWorld.cxx index 43317516fd..5202362eb3 100755 --- a/panda/src/ode/odeWorld.cxx +++ b/panda/src/ode/odeWorld.cxx @@ -107,6 +107,11 @@ get_surface(PN_uint8 surface1, PN_uint8 surface2) { true_pos = (surface2 * _num_surfaces) + surface1; } + if((_num_surfaces <= surface1) || (_num_surfaces <= surface2)) + { + odeworld_cat.error() << "surface position exceeds size of surface table, set num_surface in initSurfaceTable higher." << "\n"; + //nassertr_always((_num_surfaces > surface1 && _num_surfaces > surface2), _surface_table[true_pos]); + } return _surface_table[true_pos]; }