Skip to content

Commit

Permalink
Fix small issue with cmd line arguments (reported by @DawyD)
Browse files Browse the repository at this point in the history
  • Loading branch information
tizian authored and dvicini committed Feb 15, 2021
1 parent 37c2587 commit 268962b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ int main(int argc, char **argv) {
getFileResolver()->prepend(path.parent_path());
} else if (path.extension() == "exr") {
/* Alternatively, provide a basic OpenEXR image viewer */
Bitmap bitmap(argv[1]);
Bitmap bitmap(argv[i]);
ImageBlock block(Vector2i((int) bitmap.cols(), (int) bitmap.rows()), nullptr);
block.fromBitmap(bitmap);
nanogui::init();
Expand All @@ -198,7 +198,7 @@ int main(int argc, char **argv) {
delete screen;
nanogui::shutdown();
} else {
cerr << "Fatal error: unknown file \"" << argv[1]
cerr << "Fatal error: unknown file \"" << argv[i]
<< "\", expected an extension of type .xml or .exr" << endl;
}
} catch (const std::exception &e) {
Expand All @@ -212,10 +212,10 @@ int main(int argc, char **argv) {
}

if (sceneName != "") {
std::unique_ptr<NoriObject> root(loadFromXML(argv[1]));
std::unique_ptr<NoriObject> root(loadFromXML(sceneName));
/* When the XML root object is a scene, start rendering it .. */
if (root->getClassType() == NoriObject::EScene)
render(static_cast<Scene *>(root.get()), argv[1]);
render(static_cast<Scene *>(root.get()), sceneName);
}

return 0;
Expand Down

0 comments on commit 268962b

Please sign in to comment.