AmendHub

Download:

cyberslak

/

lightsout

/

amendments

/

24

Handle missing brightness key, update entity positions with new scrollbar value after bar_remove


cyberslak made amendment 24 16 days ago
--- ha.c Sat Mar 15 17:09:41 2025 +++ ha.c Tue Mar 18 00:29:52 2025 @@ -48,7 +48,7 @@ short ha_get_entity_state(const char* id, struct entit snprintf(out->name, 128, "%s", name->valuestring); } - if (!cJSON_IsNull(brightness)) + if (brightness && !cJSON_IsNull(brightness)) { out->brightness = brightness->valueint; --- main.c Tue Mar 18 00:37:54 2025 +++ main.c Tue Mar 18 00:41:09 2025 @@ -200,6 +200,7 @@ void scrollbar_remove(WindowPtr win) if (info->scrollBar) { DisposeControl(info->scrollBar); + info->scrollBar = NULL; } } @@ -281,14 +282,9 @@ void bar_create(WindowPtr win, const char* id) void bar_remove(WindowPtr win, struct entity *ent) { struct window_info *info = (void*)GetWRefCon(win); - short scrollValue; + short scrollValue = 0; Rect barRect; - if (info->scrollBar) - scrollValue = GetControlValue(info->scrollBar); - else - scrollValue = 0; - get_entity_bounds(ent, &barRect); list_del(&ent->node); @@ -304,8 +300,12 @@ void bar_remove(WindowPtr win, struct entity *ent) gNumBars--; - update_entity_positions(scrollValue); handle_scrollbar(win); + + if (info->scrollBar) + scrollValue = GetControlValue(info->scrollBar); + + update_entity_positions(scrollValue); } /** Update a list in a dialog.