From 18571feb61ba945e8ebab8402afe16c9eaed719a Mon Sep 17 00:00:00 2001 From: ed Date: Mon, 17 Dec 2018 09:29:27 +0000 Subject: [PATCH] Avoid calling Graphics::fillEllipse() with negative bounds in AudioAppDemo --- examples/Audio/AudioAppDemo.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/examples/Audio/AudioAppDemo.h b/examples/Audio/AudioAppDemo.h index f08e575027..b464a7d8a8 100644 --- a/examples/Audio/AudioAppDemo.h +++ b/examples/Audio/AudioAppDemo.h @@ -122,11 +122,15 @@ public: auto centreY = getHeight() / 2.0f; auto radius = amplitude * 200.0f; - // Draw an ellipse based on the mouse position and audio volume - g.setColour (Colours::lightgreen); - g.fillEllipse (jmax (0.0f, lastMousePosition.x) - radius / 2.0f, - jmax (0.0f, lastMousePosition.y) - radius / 2.0f, - radius, radius); + if (radius >= 0.0f) + { + // Draw an ellipse based on the mouse position and audio volume + g.setColour (Colours::lightgreen); + + g.fillEllipse (jmax (0.0f, lastMousePosition.x) - radius / 2.0f, + jmax (0.0f, lastMousePosition.y) - radius / 2.0f, + radius, radius); + } // Draw a representative sine wave. Path wavePath;