summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/formats/cbm_tap.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/formats/cbm_tap.cpp')
-rw-r--r--src/lib/formats/cbm_tap.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/lib/formats/cbm_tap.cpp b/src/lib/formats/cbm_tap.cpp
index 0b0950eebcc..2699ab51ec0 100644
--- a/src/lib/formats/cbm_tap.cpp
+++ b/src/lib/formats/cbm_tap.cpp
@@ -173,9 +173,7 @@ static int cbm_tap_do_work( int16_t **buffer, int length, const uint8_t *data )
int i, j = 0;
int size = 0;
- int version = data[0x0c];
- int system = data[0x0d];
- int video_standard = data[0x0e];
+ int version, system, video_standard;
int tap_frequency = 0;
int byte_samples = 0;
@@ -186,6 +184,14 @@ static int cbm_tap_do_work( int16_t **buffer, int length, const uint8_t *data )
in Commodore tapes. Implementation here would follow */
/* int waveamp_high, waveamp_low; */
+ /* is the .tap file corrupted? */
+ if ((data == nullptr) || (length <= CBM_HEADER_SIZE))
+ return -1;
+
+ version = data[0x0c];
+ system = data[0x0d];
+ video_standard = data[0x0e];
+
/* Log .TAP info but only once */
if (!(buffer == nullptr))
{
@@ -203,10 +209,6 @@ static int cbm_tap_do_work( int16_t **buffer, int length, const uint8_t *data )
return -1;
}
- /* is the .tap file corrupted? */
- if ((data == nullptr) || (length <= CBM_HEADER_SIZE))
- return -1;
-
/* read the frequency from the .tap header */
switch (system)