diff --git a/examples/audio plugin host/Source/GraphEditorPanel.cpp b/examples/audio plugin host/Source/GraphEditorPanel.cpp index 7ed59e5526..5d4d05e588 100644 --- a/examples/audio plugin host/Source/GraphEditorPanel.cpp +++ b/examples/audio plugin host/Source/GraphEditorPanel.cpp @@ -600,8 +600,14 @@ GraphEditorPanel::ConnectorComponent* GraphEditorPanel::getComponentForConnectio GraphEditorPanel::PinComponent* GraphEditorPanel::findPinAt (Point pos) const { for (auto* fc : nodes) - if (auto* pin = dynamic_cast (fc->getComponentAt (pos.toInt() - fc->getPosition()))) + { + // NB: A Visual Studio optimiser error means we have to put this Component* in a local + // variable before trying to cast it, or it gets mysteriously optimised away.. + auto* comp = fc->getComponentAt (pos.toInt() - fc->getPosition()); + + if (auto* pin = dynamic_cast (comp)) return pin; + } return nullptr; }