mirror of
https://github.com/AppleCommander/AppleCommander.git
synced 2025-02-06 21:30:06 +00:00
Handles file size of 0 appropriately.
This commit is contained in:
parent
a739924dd6
commit
4dc90d5165
@ -183,6 +183,7 @@ public class DosFileEntry implements FileEntry {
|
||||
}
|
||||
// default to nothing special, just compute from number of sectors
|
||||
int size = (getSectorsUsed()-1) * Disk.SECTOR_SIZE;
|
||||
if (size < 1) size = 0; // we assume a T/S block is included (may not be)
|
||||
if (rawdata != null) {
|
||||
if ("B".equals(getFiletype())) {
|
||||
// binary
|
||||
|
@ -398,7 +398,15 @@ public class DosFormatDisk extends FormattedDisk {
|
||||
DosFileEntry dosEntry = (DosFileEntry) fileEntry;
|
||||
// Size is calculated by sectors used - not actual size - as size varies
|
||||
// on filetype, etc.
|
||||
byte[] fileData = new byte[(dosEntry.getSectorsUsed()-1) * SECTOR_SIZE];
|
||||
int filesize = dosEntry.getSectorsUsed();
|
||||
byte[] fileData = null;
|
||||
if (filesize > 0) {
|
||||
fileData = new byte[(dosEntry.getSectorsUsed()-1) * SECTOR_SIZE];
|
||||
} else {
|
||||
fileData = new byte[0];
|
||||
// don't need to load it - also bypass potential issues
|
||||
return fileData;
|
||||
}
|
||||
int track = dosEntry.getTrack();
|
||||
int sector = dosEntry.getSector();
|
||||
int offset = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user