mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-03 01:59:35 -06:00
Do not crash if a non-existing kernel file is loaded through the Lua interface (closing #279)
This commit is contained in:
@@ -497,6 +497,11 @@ void InteractionHandler::writeKeyboardDocumentation(const std::string& type,
|
||||
}
|
||||
}
|
||||
|
||||
std::string generationTime;
|
||||
try {
|
||||
generationTime = Time::now().ISO8601();
|
||||
}
|
||||
catch (...) {}
|
||||
|
||||
std::stringstream html;
|
||||
html << "<!DOCTYPE html>\n"
|
||||
@@ -511,7 +516,7 @@ void InteractionHandler::writeKeyboardDocumentation(const std::string& type,
|
||||
<< "\t<script>\n"
|
||||
<< "var keybindings = JSON.parse('" << jsonString << "');\n"
|
||||
<< "var version = [" << OPENSPACE_VERSION_MAJOR << ", " << OPENSPACE_VERSION_MINOR << ", " << OPENSPACE_VERSION_PATCH << "];\n"
|
||||
<< "var generationTime = '" << Time::now().ISO8601() << "';\n"
|
||||
<< "var generationTime = '" << generationTime << "';\n"
|
||||
<< jsContent << "\n"
|
||||
<< "\t</script>\n"
|
||||
<< "\t<style type=\"text/css\">\n"
|
||||
|
||||
@@ -400,6 +400,12 @@ void Scene::writePropertyDocumentation(const std::string& filename, const std::s
|
||||
}
|
||||
}
|
||||
|
||||
std::string generationTime;
|
||||
try {
|
||||
generationTime = Time::now().ISO8601();
|
||||
}
|
||||
catch (...) {}
|
||||
|
||||
std::stringstream html;
|
||||
html << "<!DOCTYPE html>\n"
|
||||
<< "<html>\n"
|
||||
@@ -417,7 +423,7 @@ void Scene::writePropertyDocumentation(const std::string& filename, const std::s
|
||||
<< "var propertyOwners = JSON.parse('" << jsonString << "');\n"
|
||||
<< "var version = [" << OPENSPACE_VERSION_MAJOR << ", " << OPENSPACE_VERSION_MINOR << ", " << OPENSPACE_VERSION_PATCH << "];\n"
|
||||
<< "var sceneFilename = '" << sceneFilename << "';\n"
|
||||
<< "var generationTime = '" << Time::now().ISO8601() << "';\n"
|
||||
<< "var generationTime = '" << generationTime << "';\n"
|
||||
<< jsContent << "\n"
|
||||
<< "\t</script>\n"
|
||||
<< "\t<style type=\"text/css\">\n"
|
||||
|
||||
@@ -45,6 +45,9 @@ int loadKernel(lua_State* L) {
|
||||
}
|
||||
|
||||
std::string argument = lua_tostring(L, -1);
|
||||
if (!FileSys.fileExists(argument)) {
|
||||
return luaL_error(L, "Kernel file '%s' did not exist", argument.c_str());
|
||||
}
|
||||
unsigned int result = SpiceManager::ref().loadKernel(argument);
|
||||
|
||||
lua_pushnumber(L, result);
|
||||
|
||||
Reference in New Issue
Block a user