CComponentsForm: prevent wrong id parameter if item size out of range

This commit is contained in:
2014-11-14 23:38:52 +01:00
parent d4f466d595
commit d72603665c

View File

@@ -250,6 +250,11 @@ int CComponentsForm::genIndex()
CComponentsItem* CComponentsForm::getCCItem(const uint& cc_item_id) CComponentsItem* CComponentsForm::getCCItem(const uint& cc_item_id)
{ {
if (cc_item_id >= size()){
dprintf(DEBUG_NORMAL, "[CComponentsForm] [%s - %d] Error: parameter cc_item_id = %u, out of range (size = %u)...\n", __func__, __LINE__, cc_item_id, size());
return NULL;
}
if (v_cc_items[cc_item_id]) if (v_cc_items[cc_item_id])
return v_cc_items[cc_item_id]; return v_cc_items[cc_item_id];
return NULL; return NULL;