diff --git a/OSBindings/Mac/Clock SignalTests/Z80MachineCycleTests.swift b/OSBindings/Mac/Clock SignalTests/Z80MachineCycleTests.swift index f4037f7b5..af8252e6c 100644 --- a/OSBindings/Mac/Clock SignalTests/Z80MachineCycleTests.swift +++ b/OSBindings/Mac/Clock SignalTests/Z80MachineCycleTests.swift @@ -38,8 +38,15 @@ class Z80MachineCycleTests: XCTestCase { let length = cycle.timeStamp - totalCycles totalCycles += length - XCTAssertEqual(length, busCycles[index].length) - XCTAssertEqual(cycle.operation, busCycles[index].operation) + if index >= busCycles.count { + // this can't be reached without one of the asserts failing; + // it's to prevent an unintended exeception via out-of-bounds + // array access + break + } else { + XCTAssertEqual(length, busCycles[index].length) + XCTAssertEqual(cycle.operation, busCycles[index].operation) + } index += 1 }