mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-23 03:32:32 +00:00
Modified to return nullptr if asked for an extended disk image track that doesn't exist.
This commit is contained in:
parent
4f8b89772e
commit
2c2dd8073c
@ -57,8 +57,14 @@ std::shared_ptr<Track> CPCDSK::get_uncached_track_at_position(unsigned int head,
|
||||
// All DSK images reserve 0x100 bytes for their headers.
|
||||
long file_offset = 0x100;
|
||||
if(is_extended_) {
|
||||
// Tracks are a variable size in the original DSK file format; sum the lengths
|
||||
// of all tracks prior to the interesting one to get a file offset.
|
||||
// Tracks are a variable size in the original DSK file format.
|
||||
|
||||
// Check that there is anything stored for this track.
|
||||
if(!track_sizes_[chronological_track]) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Sum the lengths of all tracks prior to the interesting one to get a file offset.
|
||||
unsigned int t = 0;
|
||||
while(t < chronological_track && t < track_sizes_.size()) {
|
||||
file_offset += track_sizes_[t];
|
||||
|
Loading…
Reference in New Issue
Block a user