[Fix] I'd like to see VLack crash it now!! Allow for null pointer functions for buttons.
This commit is contained in:
parent
f181a7bec6
commit
8fcbca89cb
@ -104,13 +104,13 @@ void info_menu(void) {
|
|||||||
player->ship->name, "Ship", ship_view);
|
player->ship->name, "Ship", ship_view);
|
||||||
window_addButton(wid, -20, (20 + BUTTON_HEIGHT)*3 + 20,
|
window_addButton(wid, -20, (20 + BUTTON_HEIGHT)*3 + 20,
|
||||||
BUTTON_WIDTH, BUTTON_HEIGHT,
|
BUTTON_WIDTH, BUTTON_HEIGHT,
|
||||||
"btnOutfits", "Outfits", ship_view);
|
"btnOutfits", "Outfits", NULL);
|
||||||
window_addButton(wid, -20, (20 + BUTTON_HEIGHT)*2 + 20,
|
window_addButton(wid, -20, (20 + BUTTON_HEIGHT)*2 + 20,
|
||||||
BUTTON_WIDTH, BUTTON_HEIGHT,
|
BUTTON_WIDTH, BUTTON_HEIGHT,
|
||||||
"btnCargo", "Cargo", ship_view);
|
"btnCargo", "Cargo", NULL);
|
||||||
window_addButton(wid, -20, 20 + BUTTON_HEIGHT + 20,
|
window_addButton(wid, -20, 20 + BUTTON_HEIGHT + 20,
|
||||||
BUTTON_WIDTH, BUTTON_HEIGHT,
|
BUTTON_WIDTH, BUTTON_HEIGHT,
|
||||||
"btnMissions", "Missions", ship_view);
|
"btnMissions", "Missions", NULL);
|
||||||
window_addButton(wid, -20, 20,
|
window_addButton(wid, -20, 20,
|
||||||
BUTTON_WIDTH, BUTTON_HEIGHT,
|
BUTTON_WIDTH, BUTTON_HEIGHT,
|
||||||
"btnClose", "Close", info_menu_close);
|
"btnClose", "Close", info_menu_close);
|
||||||
|
@ -748,7 +748,13 @@ static void toolkit_mouseEvent(SDL_Event* event) {
|
|||||||
break;
|
break;
|
||||||
case SDL_MOUSEBUTTONUP:
|
case SDL_MOUSEBUTTONUP:
|
||||||
if(wgt->status == WIDGET_STATUS_MOUSEDOWN) {
|
if(wgt->status == WIDGET_STATUS_MOUSEDOWN) {
|
||||||
if(wgt->type == WIDGET_BUTTON) (*wgt->dat.btn.fptr)(wgt->name);
|
if(wgt->type == WIDGET_BUTTON) {
|
||||||
|
if(wgt->dat.btn.fptr == NULL)
|
||||||
|
DEBUG("Toolkit: Button '%s' of Window '%s'"
|
||||||
|
"Does not have a function trigger",
|
||||||
|
wgt->name, w->name);
|
||||||
|
else (*wgt->dat.btn.fptr)(wgt->name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
wgt->status = WIDGET_STATUS_NORMAL;
|
wgt->status = WIDGET_STATUS_NORMAL;
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user