From 75afed1c8b694d6c7624b58dd17c1f1c5bf87125 Mon Sep 17 00:00:00 2001 From: Aure7138 <100095051+Aure7138@users.noreply.github.com> Date: Thu, 30 Mar 2023 06:37:31 +0800 Subject: [PATCH] commit (#1158) --- src/util/ped.hpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/util/ped.hpp b/src/util/ped.hpp index 4ec7aaf4..09b00931 100644 --- a/src/util/ped.hpp +++ b/src/util/ped.hpp @@ -106,8 +106,14 @@ namespace big::ped outfit::components_t components; for (auto& item : components.items) { - int drawable_id = range(0, PED::GET_NUMBER_OF_PED_DRAWABLE_VARIATIONS(ped, item.id) - 1); - int texture_id = range(0, PED::GET_NUMBER_OF_PED_TEXTURE_VARIATIONS(ped, item.id, drawable_id) - 1); + int drawable_id_max = PED::GET_NUMBER_OF_PED_DRAWABLE_VARIATIONS(ped, item.id) - 1; + if (drawable_id_max == -1) + continue; + int drawable_id = range(0, drawable_id_max); + int texture_id_max = PED::GET_NUMBER_OF_PED_TEXTURE_VARIATIONS(ped, item.id, drawable_id) - 1; + if (texture_id_max == -1) + continue; + int texture_id = range(0, texture_id_max); PED::SET_PED_COMPONENT_VARIATION(ped, item.id, drawable_id, texture_id, PED::GET_PED_PALETTE_VARIATION(ped, item.id)); } }