1
0
Fork 0
mirror of https://github.com/ocornut/imgui.git synced 2026-01-11 00:04:24 +00:00

Added nullptr safety check in ImHashStr

This commit is contained in:
Kagiru 2025-12-19 04:26:18 +01:00 committed by GitHub
parent 683f9160b9
commit dcc3b48c83
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2380,6 +2380,11 @@ ImGuiID ImHashData(const void* data_p, size_t data_size, ImGuiID seed)
// FIXME-OPT: Replace with e.g. FNV1a hash? CRC32 pretty much randomly access 1KB. Need to do proper measurements.
ImGuiID ImHashStr(const char* data_p, size_t data_size, ImGuiID seed)
{
if (data_p == nullptr)
{
return seed;
}
seed = ~seed;
ImU32 crc = seed;
const unsigned char* data = (const unsigned char*)data_p;