[Offload] Fix isValidBinary segfault on host platform

Summary:
Need to verify this actually has a device. We really need to rework this
to point to a real impolementation, or streamline it to handle this
automatically.
This commit is contained in:
Joseph Huber
2025-10-06 14:45:22 -05:00
parent 24d41c1a7d
commit 095877c12e

View File

@@ -1004,8 +1004,9 @@ Error olCreateProgram_impl(ol_device_handle_t Device, const void *ProgData,
Error olIsValidBinary_impl(ol_device_handle_t Device, const void *ProgData,
size_t ProgDataSize, bool *IsValid) {
StringRef Buffer(reinterpret_cast<const char *>(ProgData), ProgDataSize);
*IsValid = Device->Device->Plugin.isDeviceCompatible(
Device->Device->getDeviceId(), Buffer);
*IsValid = Device->Device ? Device->Device->Plugin.isDeviceCompatible(
Device->Device->getDeviceId(), Buffer)
: false;
return Error::success();
}