Skip to content
Permalink
Browse files

Fix #992: guiCreateStaticImage should warn on failure (#1041)

Previously, guiCreateStaticImage did not output an error if the file does not exist. this has now been fixed.
  • Loading branch information...
CrosRoad95 authored and qaisjp committed Aug 11, 2019
1 parent 866816f commit 061a49aaca2ee200dc7f9fae0572245d855042d3
Showing with 13 additions and 3 deletions.
  1. +13 −3 Client/mods/deathmatch/logic/luadefs/CLuaGUIDefs.cpp
@@ -795,9 +795,19 @@ int CLuaGUIDefs::GUICreateStaticImage(lua_State* luaVM)
SString strPath;
if (CResourceManager::ParseResourcePathInput(path, pResource, &strPath))
{
CClientGUIElement* pGUIElement = CStaticFunctionDefinitions::GUICreateStaticImage(*pLuaMain, position, size, strPath, relative, parent);
lua_pushelement(luaVM, pGUIElement);
return 1;
if (FileExists(strPath))
{
CClientGUIElement* pGUIElement = CStaticFunctionDefinitions::GUICreateStaticImage(*pLuaMain, position, size, strPath, relative, parent);
if (pGUIElement != nullptr)
{
lua_pushelement(luaVM, pGUIElement);
return 1;
}
else
argStream.SetCustomError(path, "Failed to create static image");
}
else
argStream.SetCustomError(path, "File not found");
}
else
argStream.SetCustomError(path, "Bad file path");

0 comments on commit 061a49a

Please sign in to comment.
You can’t perform that action at this time.