From 756a37ecac100f9f35f205fe8c79ca4155129327 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Sun, 20 Oct 2024 19:43:00 -0400 Subject: [PATCH] Fix crash if shpk_name is null This is common for the new Dawntrail models where I think this is failing on, and should at least prevent an easy crash. --- parts/mdl/mdlpart.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parts/mdl/mdlpart.cpp b/parts/mdl/mdlpart.cpp index 709e493..04ee53c 100644 --- a/parts/mdl/mdlpart.cpp +++ b/parts/mdl/mdlpart.cpp @@ -348,7 +348,7 @@ RenderMaterial MDLPart::createOrCacheMaterial(const physis_Material &mat) uint64_t MDLPart::getMaterialHash(const physis_Material &mat) { // TODO: this hash is terrible - uint64_t hash = strlen(mat.shpk_name); + uint64_t hash = mat.shpk_name ? strlen(mat.shpk_name) : 0; hash += mat.num_constants; hash += mat.num_samplers; hash += mat.num_shader_keys;