diff options
author | David Robillard <d@drobilla.net> | 2023-09-22 12:36:22 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2023-09-22 12:36:29 -0400 |
commit | b25b04a88767ae3dc142076dd3bdeefbaa549690 (patch) | |
tree | b20193a611d4525962a09486f94aa5eb609c2298 /src/gui | |
parent | 97f5ecf41bccbc6339a18c649cd7bfcd84b18312 (diff) | |
download | ingen-b25b04a88767ae3dc142076dd3bdeefbaa549690.tar.gz ingen-b25b04a88767ae3dc142076dd3bdeefbaa549690.tar.bz2 ingen-b25b04a88767ae3dc142076dd3bdeefbaa549690.zip |
Avoid potential null dereferences
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/GraphBox.cpp | 4 | ||||
-rw-r--r-- | src/gui/PropertiesWindow.cpp | 9 |
2 files changed, 10 insertions, 3 deletions
diff --git a/src/gui/GraphBox.cpp b/src/gui/GraphBox.cpp index 414bbef4..9efba2ee 100644 --- a/src/gui/GraphBox.cpp +++ b/src/gui/GraphBox.cpp @@ -252,6 +252,10 @@ GraphBox::create(App& app, const std::shared_ptr<const GraphModel>& graph) GraphBox* result = nullptr; const Glib::RefPtr<Gtk::Builder> xml = WidgetFactory::create("graph_win"); xml->get_widget_derived("graph_win_vbox", result); + if (!result) { + return {}; + } + result->init_box(app); result->set_graph(graph, nullptr); diff --git a/src/gui/PropertiesWindow.cpp b/src/gui/PropertiesWindow.cpp index b51ae37e..042718a0 100644 --- a/src/gui/PropertiesWindow.cpp +++ b/src/gui/PropertiesWindow.cpp @@ -501,10 +501,13 @@ PropertiesWindow::get_value(LV2_URID type, Gtk::Widget* value_widget) } } else if (type == forge.URI || type == forge.URID) { auto* uri_entry = dynamic_cast<URIEntry*>(value_widget); - if (uri_entry && URI::is_valid(uri_entry->get_text())) { - return _app->forge().make_urid(URI(uri_entry->get_text())); + if (uri_entry) { + if (URI::is_valid(uri_entry->get_text())) { + return _app->forge().make_urid(URI(uri_entry->get_text())); + } + + _app->log().error("Invalid URI <%1%>\n", uri_entry->get_text()); } - _app->log().error("Invalid URI <%1%>\n", uri_entry->get_text()); } else if (type == forge.String) { auto* entry = dynamic_cast<Gtk::Entry*>(value_widget); if (entry) { |