From 96912c578dd1a040a453e04f225bfe3246b0a43a Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 4 Oct 2010 18:44:38 +0000 Subject: Gracefully handle UIs that try to write to illegal port indices. Patch from Lars Luthman (ticket #530). git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2625 a436a847-0d15-0410-975c-d299462d15a1 --- src/client/PluginUI.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/client/PluginUI.cpp b/src/client/PluginUI.cpp index 3a3b3270..74d87a13 100644 --- a/src/client/PluginUI.cpp +++ b/src/client/PluginUI.cpp @@ -53,7 +53,14 @@ lv2_ui_write(LV2UI_Controller controller, PluginUI* ui = (PluginUI*)controller; - SharedPtr port = ui->node()->ports()[port_index]; + NodeModel::Ports ports = ui->node()->ports(); + if (port_index >= ports.size()) { + error << "UI for " << ui->node()->plugin()->uri() + << " tried to write to non-existent port " << port_index << endl; + return; + } + + SharedPtr port = ports[port_index]; const Shared::LV2URIMap& uris = *ui->world()->uris().get(); -- cgit v1.2.1