1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-09 23:34:20 +00:00

DemoRunner: Protect against null peer when updating renderer

This commit is contained in:
reuk 2025-06-12 13:20:29 +01:00
parent 8fd73d33a8
commit 0a71227126
No known key found for this signature in database

View file

@ -442,7 +442,7 @@ void MainComponent::parentHierarchyChanged()
#if JUCE_ANDROID #if JUCE_ANDROID
currentRenderingEngineIdx = (renderingEngines.size() - 1); currentRenderingEngineIdx = (renderingEngines.size() - 1);
#else #else
currentRenderingEngineIdx = peer->getCurrentRenderingEngine(); currentRenderingEngineIdx = peer != nullptr ? peer->getCurrentRenderingEngine() : -1;
#endif #endif
} }
@ -462,7 +462,9 @@ void MainComponent::updateRenderingEngine (int renderingEngineIndex)
else else
{ {
openGLContext.detach(); openGLContext.detach();
peer->setCurrentRenderingEngine (renderingEngineIndex);
if (peer != nullptr)
peer->setCurrentRenderingEngine (renderingEngineIndex);
} }
currentRenderingEngineIdx = renderingEngineIndex; currentRenderingEngineIdx = renderingEngineIndex;