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:
parent
5401882ed0
commit
57c1b3eda6
|
@ -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]
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue