1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-25 17:29:50 +00:00

.byt "" emits no data; avoid a ca65 crash.

Fixes #775 on GitHub.
This commit is contained in:
Greg King 2018-10-20 13:40:16 -04:00
parent 385260e453
commit 554448a1f1

View File

@ -574,7 +574,7 @@ static void DoByte (void)
/* Record type information */ /* Record type information */
Span* S = OpenSpan (); Span* S = OpenSpan ();
StrBuf Type = STATIC_STRBUF_INITIALIZER; StrBuf Type = AUTO_STRBUF_INITIALIZER;
/* Parse arguments */ /* Parse arguments */
while (1) { while (1) {
@ -598,9 +598,14 @@ static void DoByte (void)
} }
} }
/* Close the span, then add type information to it */ /* Close the span, then add type information to it.
** Note: empty string operands emit nothing;
** so, add a type only if there's a span.
*/
S = CloseSpan (S); S = CloseSpan (S);
SetSpanType (S, GenArrayType (&Type, GetSpanSize (S), EType, sizeof (EType))); if (S != 0) {
SetSpanType (S, GenArrayType (&Type, GetSpanSize (S), EType, sizeof (EType)));
}
/* Free the type string */ /* Free the type string */
SB_Done (&Type); SB_Done (&Type);