diff src/modules/image/wrap_ImageData.cpp @ 1418:357697c2e2a8

More internal code cleanup
author Alex Szpakowski <slime73@gmail.com>
date Sun, 31 Mar 2013 19:02:27 -0300
parents d9d550a73ebf
children 5b9ebe6a9a7e
line wrap: on
line diff
--- a/src/modules/image/wrap_ImageData.cpp	Sun Mar 31 04:55:03 2013 -0300
+++ b/src/modules/image/wrap_ImageData.cpp	Sun Mar 31 19:02:27 2013 -0300
@@ -167,13 +167,14 @@
 	{
 		ext = file->getExtension();
 		fmt = ext.c_str();
-		ImageData::getConstant(fmt, format);
+		if (!ImageData::getConstant(fmt, format))
+			return luaL_error(L, "Invalid image format '%s'.", fmt);
 	}
 	else
 	{
 		fmt = luaL_checkstring(L, 3);
 		if (!ImageData::getConstant(fmt, format))
-			luaL_error(L, "Invalid image format.");
+			return luaL_error(L, "Invalid image format '%s'.", fmt);
 	}
 
 	try
@@ -189,7 +190,6 @@
 
 static const luaL_Reg functions[] =
 {
-
 	// Data
 	{ "getPointer", w_Data_getPointer },
 	{ "getSize", w_Data_getSize },