system: handle invalid enablement in String method

Invalid enablement is only caused by bad API usage, however panicking on the spot leaves behind messy state that has to be manually cleaned up.

Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
This commit is contained in:
cat
2024-10-17 14:31:13 +09:00
parent 5401882ed0
commit 57c1b3eda6
+3
View File
@@ -24,6 +24,9 @@ var enablementString = [...]string{
const ELen = len(enablementString)
func (e Enablement) String() string {
if int(e) >= ELen {
return "<invalid enablement>"
}
return enablementString[e]
}