Przeglądaj źródła

!2 fix entity list num

chenliangyu 7 miesięcy temu
rodzic
commit
ea3070f651
1 zmienionych plików z 1 dodań i 1 usunięć
  1. 1 1
      Framework/spbase/sp_mod.c

+ 1 - 1
Framework/spbase/sp_mod.c

@@ -1636,7 +1636,7 @@ sp_entity_t *sp_mod_find_entity_by_name(sp_mod_t *mod, const char *entity_name)
 
 sp_entity_t *sp_mod_find_entity_by_idx(sp_mod_t *mod, int entity_idx)
 {
-	if (entity_idx == -1 || entity_idx >= mod->mgr->arr_ent->nelts)
+	if (entity_idx == -1 || entity_idx > mod->mgr->arr_ent->nelts)
 		return NULL;
 
 	return ARRAY_IDX(mod->mgr->arr_ent, entity_idx, sp_entity_t*);