[Bug] Don't crash when formatting label without having an emitter

This commit is contained in:
kobalicek
2023-03-10 20:20:20 +01:00
parent 1098b7d887
commit d7edac813a

View File

@@ -123,6 +123,7 @@ Error formatLabel(
DebugUtils::unused(formatFlags); DebugUtils::unused(formatFlags);
if (emitter && emitter->code()) {
const LabelEntry* le = emitter->code()->labelEntry(labelId); const LabelEntry* le = emitter->code()->labelEntry(labelId);
if (ASMJIT_UNLIKELY(!le)) if (ASMJIT_UNLIKELY(!le))
return sb.appendFormat("<InvalidLabel:%u>", labelId); return sb.appendFormat("<InvalidLabel:%u>", labelId);
@@ -146,9 +147,9 @@ Error formatLabel(
ASMJIT_PROPAGATE(sb.appendFormat("L%u@", labelId)); ASMJIT_PROPAGATE(sb.appendFormat("L%u@", labelId));
return sb.append(le->name()); return sb.append(le->name());
} }
else {
return sb.appendFormat("L%u", labelId);
} }
return sb.appendFormat("L%u", labelId);
} }
Error formatRegister( Error formatRegister(