Skip to content

Commit 585d4eb

Browse files
committed
Emit null in C export when empty array
1 parent 0623f3f commit 585d4eb

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/codegen.pas

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,10 @@ procedure RenderSongToGBDKC(Song: TSong; DescriptorName: String; Filename: strin
266266
itWave: InstrType := 'hUGEWaveInstr_t';
267267
itNoise: InstrType := 'hUGENoiseInstr_t';
268268
end;
269+
270+
if Limit = -1 then
271+
Exit('static const ' + InstrType + '* ' + Name + ' = NULL;'+LineEnding);
272+
269273
Result := 'static const ' + InstrType + ' ' + Name + '[] = {'+LineEnding;
270274
for I := Low(Bank) to Limit do begin
271275
Result += ' '+RenderGBDKInstrument(Bank[I], I) + ','+LineEnding;
@@ -277,6 +281,9 @@ procedure RenderSongToGBDKC(Song: TSong; DescriptorName: String; Filename: strin
277281
var
278282
I, J: integer;
279283
begin
284+
if Limit = -1 then
285+
Exit('static const unsigned char* waves = NULL;'+LineEnding);
286+
280287
Result := 'static const unsigned char waves[] = {'+LineEnding;
281288
for I := Low(Waves) to Limit do
282289
begin

0 commit comments

Comments
 (0)