LibGUI: Complain about malformed "layout" values in JSON GUI

This commit is contained in:
Andreas Kling 2020-09-14 13:01:09 +02:00
parent aa3c28957a
commit 6590eb8eb7
Notes: sideshowbarker 2024-07-19 02:25:35 +09:00

View file

@ -949,6 +949,10 @@ bool Widget::load_from_json(const JsonObject& json)
set_preferred_size(preferred_width.to_i32(), preferred_size().height());
auto layout_value = json.get("layout");
if (!layout_value.is_null() && !layout_value.is_object()) {
dbg() << "layout is not an object";
return false;
}
if (layout_value.is_object()) {
auto& layout = layout_value.as_object();
auto class_name = layout.get("class");