Skip to content

Commit

Permalink
Fix segfault when -model option is not used (meaning default model is…
Browse files Browse the repository at this point in the history
… used)
  • Loading branch information
fspindle committed Apr 23, 2024
1 parent c84a1e6 commit 83a6723
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tutorial/ar/tutorial-panda3d-renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ int main(int argc, const char **argv)
{
bool invertTexture = false;
bool stepByStep = false;
char *modelPathCstr;
char *modelPathCstr = nullptr;
vpParseArgv::vpArgvInfo argTable[] =
{
{"-invert", vpParseArgv::ARGV_CONSTANT_BOOL, 0, (char *)&invertTexture,
Expand All @@ -69,8 +69,11 @@ int main(int argc, const char **argv)
return (false);
}

std::string modelPath(modelPathCstr);
if (modelPath.size() == 0) {
std::string modelPath;
if (modelPathCstr) {
modelPath = modelPathCstr;
}
else {
modelPath = "data/deformed_sphere.bam";
}
vpPanda3DRenderParameters renderParams(vpCameraParameters(300, 300, 160, 120), 240, 320, 0.01, 1.0);
Expand Down

0 comments on commit 83a6723

Please sign in to comment.