add: if (index >= WMGetBagItemCount(bPtr->items) || index < 0) return NULL;
context: WMGetPopUpButtonItem(WMPopUpButton *bPtr, int index){    WMMenuItem *item;    item = WMGetFromBag(bPtr->items, index);    if (!item)	return NULL;    return WMGetMenuItemTitle(item);}