From dbd173471db4103d6e2943ab95ec1f43c5b85a18 Mon Sep 17 00:00:00 2001 From: Eugene Obrezkov Date: Sat, 13 Jun 2020 13:58:35 +0300 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20when=20animating=20code?= =?UTF-8?q?=20can=20throw=20an=20error=20"wrong=20syntax"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/shapes/kittik-shape-code/src/Code.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/shapes/kittik-shape-code/src/Code.ts b/src/shapes/kittik-shape-code/src/Code.ts index f42c270..6f75770 100644 --- a/src/shapes/kittik-shape-code/src/Code.ts +++ b/src/shapes/kittik-shape-code/src/Code.ts @@ -30,7 +30,13 @@ export class Code extends Shape implements CodeOptions, ShapeRenderable { public render (canvas: T): void { super.render(canvas); - const codeSplits = redeyed(this.text, DEFAULT_THEME).splits; + let codeSplits: string[] = []; + try { + codeSplits = redeyed(this.text, DEFAULT_THEME).splits; + } catch (error) { + codeSplits = [this.text]; + } + const x = parseInt(this.x, 10); const y = parseInt(this.y, 10);