From 96ebe82149d225cdb4b96aa145bb5a2dbb6a948a Mon Sep 17 00:00:00 2001 From: glacambre Date: Fri, 15 Jun 2018 07:15:39 +0200 Subject: [PATCH] styling.ts: Avoir errors when calling capitalise on 0-length strings --- src/styling.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/styling.ts b/src/styling.ts index 4fecc5df..b3f128ef 100644 --- a/src/styling.ts +++ b/src/styling.ts @@ -8,6 +8,7 @@ const logger = new Logging.Logger("styling") const THEMES = ["dark", "greenmat", "shydactyl", "quake"] function capitalise(str) { + if (str === "") return str return str[0].toUpperCase() + str.slice(1) }