OpenXR-Hpp icon indicating copy to clipboard operation
OpenXR-Hpp copied to clipboard

```enumerateInstanceExtensionPropertiesToVector``` redundant assert

Open gosha-krovsh opened this issue 1 year ago • 1 comments

enumerateInstanceExtensionPropertiesToVector can be usefull to check whether openXR libraries are installed on user's PC. Like this:

!xr::enumerateInstanceExtensionPropertiesToVector(nullptr).empty();

But the assert inside ruins this solution and the same logic, so an option using more lines of code is commonly used:

uint32_t property_count = 0;
auto result = xr::enumerateInstanceExtensionProperties(nullptr, 0, &property_count, nullptr);
return XR_SUCCEEDED(result) && property_count != 0;

The suggestion is to remove redundant assert

gosha-krovsh avatar Nov 13 '24 20:11 gosha-krovsh

It seems that the real problem in all the *ToVector functions implemantation is using assert on error instead of throwing exception.

antoineemerit avatar Oct 05 '25 01:10 antoineemerit