Avoid calling std::vector::data() if empty

This commit is contained in:
Eladash 2024-04-22 17:42:14 +03:00 committed by Elad Ashkenazi
parent b83e39a540
commit 0791349455

View File

@ -4427,6 +4427,8 @@ void spu_recompiler_base::dump(const spu_program& result, std::string& out)
SPUDisAsm dis_asm(cpu_disasm_mode::dump, reinterpret_cast<const u8*>(result.data.data()), result.lower_bound);
std::string hash;
if (!result.data.empty())
{
sha1_context ctx;
u8 output[20];
@ -4436,6 +4438,10 @@ void spu_recompiler_base::dump(const spu_program& result, std::string& out)
sha1_finish(&ctx, output);
fmt::append(hash, "%s", fmt::base57(output));
}
else
{
hash = "N/A";
}
fmt::append(out, "========== SPU BLOCK 0x%05x (size %u, %s) ==========\n\n", result.entry_point, result.data.size(), hash);