Skip to content

Commit c9a790a

Browse files
authored
Merge pull request #272 from ThKattanek/issue#271
#271 Fixed export prg from d64 image
2 parents 7840b8e + 10e5b0a commit c9a790a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/d64_class.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,12 @@ bool D64Class::ExportPrg(int file_number, const char *filename)
116116
uint8_t current_track = d64_files[file_number].Track;
117117
uint8_t current_sector = d64_files[file_number].Sektor;
118118

119-
while(current_track != 0)
119+
while(current_track != 0 && block_count > 0)
120120
{
121121
ReadBlock(current_track, current_sector, block);
122122
current_track = block[0];
123123
current_sector = block[1];
124+
block_count--;
124125
if(current_track == 0) fwrite(block+2, 1, current_sector - 1, file);
125126
else fwrite(block+2, 1, 254, file);
126127
}

0 commit comments

Comments
 (0)