From a3fdb460c464960f4762a2141601091d52c5140e Mon Sep 17 00:00:00 2001 From: Simon Date: Tue, 4 Apr 2023 23:03:31 +0100 Subject: [PATCH] Prevent crash when throwing Saber seems it is indexing the g2 model surface that doesn't exist, might be something to do with the new hilt and the old hilt being in the save. Not sure, but this stops it crashing. --- Projects/Android/jni/OpenJK/code/rd-gles/G2_misc.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Projects/Android/jni/OpenJK/code/rd-gles/G2_misc.cpp b/Projects/Android/jni/OpenJK/code/rd-gles/G2_misc.cpp index 58ad732..475e6d6 100644 --- a/Projects/Android/jni/OpenJK/code/rd-gles/G2_misc.cpp +++ b/Projects/Android/jni/OpenJK/code/rd-gles/G2_misc.cpp @@ -1769,7 +1769,10 @@ void *G2_FindSurface(const model_s *mod, int index, int lod) mdxmLODSurfOffset_t *indexes = (mdxmLODSurfOffset_t *)current; // we are now looking at the offset array - assert(index>=0&&indexmdxm->numSurfaces); + if (index >= mod->mdxm->numSurfaces) + { + index = mod->mdxm->numSurfaces-1; + } current += indexes->offsets[index]; return (void *)current;