From a2e2a9b72e90e3419ff792491cd30aba86d2d4e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20N=C3=BCcke?= Date: Tue, 12 Aug 2014 02:51:17 +0200 Subject: [PATCH] Fixed index out of bounds in term.isWide, closes #484. --- .../assets/opencomputers/loot/OpenOS/lib/term.lua | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/resources/assets/opencomputers/loot/OpenOS/lib/term.lua b/src/main/resources/assets/opencomputers/loot/OpenOS/lib/term.lua index 8428c2563..c02a77f1b 100644 --- a/src/main/resources/assets/opencomputers/loot/OpenOS/lib/term.lua +++ b/src/main/resources/assets/opencomputers/loot/OpenOS/lib/term.lua @@ -81,6 +81,13 @@ function term.setCursorBlink(enabled) end function term.isWide(x, y) + if not term.isAvailable() then + return false + end + local w, h = component.gpu.getResolution() + if x < 1 or x > w or y < 1 or y > h then + return false + end local char = component.gpu.get(x, y) if unicode.isWide(char) then -- The char at the specified position is a wide char.