From 2bb9a9390f620125bc098d88a360a0ca510327bb Mon Sep 17 00:00:00 2001 From: sk89q Date: Sun, 23 Jan 2011 02:03:33 -0800 Subject: [PATCH] Fixed a lack of an error message in draw.js. --- craftscripts/draw.js | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/craftscripts/draw.js b/craftscripts/draw.js index fbcb67eac..4d40cddcb 100644 --- a/craftscripts/draw.js +++ b/craftscripts/draw.js @@ -78,17 +78,21 @@ var sess = context.remember(); context.checkArgs(1, 1, ""); -var img = ImageIO.read(context.getSafeFile("drawings", argv[1])); +var f = context.getSafeFile("drawings", argv[1]); -var width = img.getWidth(); -var height = img.getHeight(); +if (f != null) { + var img = ImageIO.read(f); -var origin = player.getBlockIn(); + var width = img.getWidth(); + var height = img.getHeight(); -for (var x = 0; x < width; x++) { - for (var y = 0; y < height; y++) { - var c = new Color(img.getRGB(x, y)); - var data = findClosestWoolColor(c); - sess.setBlock(origin.add(x, 0, y), new BaseBlock(35, data)); + var origin = player.getBlockIn(); + + for (var x = 0; x < width; x++) { + for (var y = 0; y < height; y++) { + var c = new Color(img.getRGB(x, y)); + var data = findClosestWoolColor(c); + sess.setBlock(origin.add(x, 0, y), new BaseBlock(35, data)); + } } } \ No newline at end of file