Permalink
Browse files

Fix an error occurs in utils.colorize when string is nil.

  • Loading branch information...
hnakamur committed Aug 27, 2012
1 parent 6727d4f commit 21e5d9ed5f67193630ac03328e5c8df587835286
Showing with 5 additions and 1 deletion.
  1. +1 −1 lib/luvit/utils.lua
  2. +4 −0 tests/test-utils.lua
View
@@ -53,7 +53,7 @@ function utils.color(color_name)
end
function utils.colorize(color_name, string, reset_name)
- return utils.color(color_name) .. string .. utils.color(reset_name)
+ return utils.color(color_name) .. tostring(string) .. utils.color(reset_name)
end
local backslash, null, newline, carriage, tab, quote, quote2, obracket, cbracket
View
@@ -91,3 +91,7 @@ bound('!', function(arg1, arg2, arg3)
assert(arg2 == 'world')
assert(arg3 == '!')
end)
+
+local Error = require('core').Error
+local MyError = Error:extend()
+assert(pcall(utils.dump, MyError))

0 comments on commit 21e5d9e

Please sign in to comment.