1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-10-08 00:55:57 +00:00

Speculative fix for reported FormatDataOp crash

This adds a null check on the dfd argument in FormatDataOp() to see
if we can prevent a crash.  The opcode/operand are presented as
"!FAILED!" to make it obvious to the user that something has gone
wrong.  Hopefully this will allow capture of a project that exhibits
the problem.
This commit is contained in:
Andy McFadden 2018-10-26 15:15:52 -07:00
parent 2cb6b55802
commit 975ae1eb28

View File

@ -259,6 +259,14 @@ namespace SourceGen {
public static PseudoOut FormatDataOp(Formatter formatter, PseudoOpNames opNames,
SymbolTable symbolTable, Dictionary<string, string> labelMap,
FormatDescriptor dfd, byte[] data, int offset, int subIndex) {
if (dfd == null) {
// should never happen
//Debug.Assert(false, "Null dfd at offset+" + offset.ToString("x6"));
PseudoOut failed = new PseudoOut();
failed.Opcode = failed.Operand = "!FAILED!+" + offset.ToString("x6");
return failed;
}
int length = dfd.Length;
Debug.Assert(length > 0);