catch NULL bar_item earlier

This commit is contained in:
Felix Kratz 2021-10-13 14:34:43 +02:00
parent 27db928fa6
commit af35c54757
2 changed files with 1 additions and 3 deletions

View file

@ -229,14 +229,12 @@ void bar_item_on_click(struct bar_item* bar_item) {
}
void bar_item_mouse_entered(struct bar_item* bar_item) {
if (!bar_item) return;
bar_item->mouse_over = true;
if (bar_item->update_mask & UPDATE_MOUSE_ENTERED)
bar_item_update(bar_item, COMMAND_SUBSCRIBE_MOUSE_ENTERED, true);
}
void bar_item_mouse_exited(struct bar_item* bar_item) {
if (!bar_item) return;
if (bar_item->mouse_over && (bar_item->update_mask & UPDATE_MOUSE_EXITED)) bar_item_update(bar_item, COMMAND_SUBSCRIBE_MOUSE_EXITED, true);
bar_item->mouse_over = false;
}

View file

@ -286,7 +286,7 @@ void bar_manager_custom_events_trigger(struct bar_manager* bar_manager, char* na
}
void bar_manager_handle_mouse_entered(struct bar_manager* bar_manager, struct bar_item* bar_item) {
if (bar_item->mouse_over) return;
if (!bar_item || bar_item->mouse_over) return;
for (int i = 0; i < bar_manager->bar_item_count; i++)
bar_item_mouse_exited(bar_item);