diff --git a/src/com/webcodepro/applecommander/storage/ProdosFormatDisk.java b/src/com/webcodepro/applecommander/storage/ProdosFormatDisk.java index 406c205..7c743f3 100644 --- a/src/com/webcodepro/applecommander/storage/ProdosFormatDisk.java +++ b/src/com/webcodepro/applecommander/storage/ProdosFormatDisk.java @@ -671,7 +671,11 @@ public class ProdosFormatDisk extends FormattedDisk { int blocksOnDisk = getBitmapLength(); while (block < blocksOnDisk) { if (isBlockFree(volumeBitmap,block)) { - return block; + if ((block+1) * BLOCK_SIZE < getDiskImage().length) { + return block; + } + throw new ProdosDiskSizeDoesNotMatchException( + "The ProDOS physical disk size does not match the formatted size."); } block++; }