diff --git a/modules/juce_core/native/juce_win32_SystemStats.cpp b/modules/juce_core/native/juce_win32_SystemStats.cpp index 0207014bb4..2361a8d4eb 100644 --- a/modules/juce_core/native/juce_win32_SystemStats.cpp +++ b/modules/juce_core/native/juce_win32_SystemStats.cpp @@ -99,10 +99,10 @@ static int findNumberOfPhysicalCores() noexcept { int numPhysicalCores = 0; DWORD bufferSize = 0; + GetLogicalProcessorInformation (nullptr, &bufferSize); - if (GetLogicalProcessorInformation (nullptr, &bufferSize)) + if (auto numBuffers = (size_t) (bufferSize / sizeof (SYSTEM_LOGICAL_PROCESSOR_INFORMATION))) { - const size_t numBuffers = (size_t) (bufferSize / sizeof (SYSTEM_LOGICAL_PROCESSOR_INFORMATION)); HeapBlock buffer (numBuffers); if (GetLogicalProcessorInformation (buffer, &bufferSize))