diff --git a/libs/surfaces/osc/osc.cc b/libs/surfaces/osc/osc.cc index eeb13106e9..c9f4b707c1 100644 --- a/libs/surfaces/osc/osc.cc +++ b/libs/surfaces/osc/osc.cc @@ -4535,21 +4535,23 @@ OSC::sel_plugin_activate (float state, lo_message msg) return -1; } OSCSurface *sur = get_surface(get_address (msg)); - boost::shared_ptr s = sur->select; + if (sur->plugins.size() > 0) { + boost::shared_ptr s = sur->select; - boost::shared_ptr r = boost::dynamic_pointer_cast (s); + boost::shared_ptr r = boost::dynamic_pointer_cast (s); - if (r) { - boost::shared_ptr redi=r->nth_plugin (sur->plugins[sur->plugin_id -1]); - if (redi) { - boost::shared_ptr pi; - if ((pi = boost::dynamic_pointer_cast(redi))) { - if(state > 0) { - pi->activate(); - } else { - pi->deactivate(); + if (r) { + boost::shared_ptr redi=r->nth_plugin (sur->plugins[sur->plugin_id -1]); + if (redi) { + boost::shared_ptr pi; + if ((pi = boost::dynamic_pointer_cast(redi))) { + if(state > 0) { + pi->activate(); + } else { + pi->deactivate(); + } + return 0; } - return 0; } } }