diff --git a/sycl/source/detail/adapter.hpp b/sycl/source/detail/adapter.hpp index ef2ce4f513773..700585a4d6a72 100644 --- a/sycl/source/detail/adapter.hpp +++ b/sycl/source/detail/adapter.hpp @@ -100,8 +100,10 @@ class Adapter { uint32_t platformCount = 0; call(&MAdapter, 1, 0, nullptr, &platformCount); UrPlatforms.resize(platformCount); - call(&MAdapter, 1, platformCount, - UrPlatforms.data(), nullptr); + if (platformCount) { + call(&MAdapter, 1, platformCount, + UrPlatforms.data(), nullptr); + } // We need one entry in this per platform LastDeviceIds.resize(platformCount); });