From f6c0feda4b87bcb0d0259a79cca0c45dd087c07b Mon Sep 17 00:00:00 2001 From: Djeeberjr Date: Fri, 27 Jan 2023 13:50:51 +0100 Subject: [PATCH] catch setDiskLabel error --- src/kernel/peripherals/Drive.hx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/kernel/peripherals/Drive.hx b/src/kernel/peripherals/Drive.hx index 726f422..e8eae50 100644 --- a/src/kernel/peripherals/Drive.hx +++ b/src/kernel/peripherals/Drive.hx @@ -51,8 +51,13 @@ class Drive implements IPeripheral { this.native.setDiskLabel(); } - public inline function setDiskLabel(label: String) { - this.native.setDiskLabel(label); + public inline function setDiskLabel(label: String): Null { + try { + this.native.setDiskLabel(label); + return null; + } catch (e: Dynamic) { + return new Error("Invalid label"); + } } public inline function hasData():Bool {