From 5683d614353e01bcbf6054264834f4ba01ddf90c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20N=C3=BCcke?= Date: Mon, 21 Jul 2014 20:36:14 +0200 Subject: [PATCH] Fixed derp in gpu.set introduced with wide char checks (aka 'index out of bounds of doom'). --- src/main/scala/li/cil/oc/util/TextBuffer.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/scala/li/cil/oc/util/TextBuffer.scala b/src/main/scala/li/cil/oc/util/TextBuffer.scala index 23dd12841..1d885a8eb 100644 --- a/src/main/scala/li/cil/oc/util/TextBuffer.scala +++ b/src/main/scala/li/cil/oc/util/TextBuffer.scala @@ -128,7 +128,7 @@ class TextBuffer(var width: Int, var height: Int, initialFormat: PackedColor.Col val c = s(x - col) changed = changed || (line(bx) != c) || (lineColor(bx) != packed) setChar(line, lineColor, bx, c) - bx += FontUtil.wcwidth(c) + bx += math.max(1, FontUtil.wcwidth(c)) } changed } @@ -147,7 +147,7 @@ class TextBuffer(var width: Int, var height: Int, initialFormat: PackedColor.Col for (x <- bx until math.min(col + w, width) if bx < line.length) { changed = changed || (line(bx) != c) || (lineColor(bx) != packed) setChar(line, lineColor, bx, c) - bx += FontUtil.wcwidth(c) + bx += math.max(1, FontUtil.wcwidth(c)) } } changed