Commit 5e60a9b8 authored by Charles Law's avatar Charles Law
Browse files

Protect against null selfPath. I do not know how it worked before!

parent e611bf4b
......@@ -111,7 +111,7 @@
//----------------------------------------------------------------------------
vtkStandardNewMacro(vtkPVApplication);
vtkCxxRevisionMacro(vtkPVApplication, "1.296");
vtkCxxRevisionMacro(vtkPVApplication, "1.297");
vtkCxxSetObjectMacro(vtkPVApplication, RenderModule, vtkPVRenderModule);
......@@ -2223,21 +2223,23 @@ char* vtkPVApplication::GetDemoPath()
vtkKWDirectoryUtilities* util = vtkKWDirectoryUtilities::New();
const char* selfPath = util->FindSelfPath(
this->GetArgv0());
const char* relPath = "../share/paraview-" PARAVIEW_VERSION "/Demos";
char* newPath = new char[strlen(selfPath)+strlen(relPath)+2];
sprintf(newPath, "%s/%s", selfPath, relPath);
if (selfPath)
{
const char* relPath = "../share/paraview-" PARAVIEW_VERSION "/Demos";
char* newPath = new char[strlen(selfPath)+strlen(relPath)+2];
sprintf(newPath, "%s/%s", selfPath, relPath);
char* demoFile = new char[strlen(newPath)+strlen("/Demo1.pvs")+1];
sprintf(demoFile, "%s/Demo1.pvs", newPath);
char* demoFile = new char[strlen(newPath)+strlen("/Demo1.pvs")+1];
sprintf(demoFile, "%s/Demo1.pvs", newPath);
if (stat(demoFile, &fs) == 0)
{
this->SetDemoPath(newPath);
found = 1;
if (stat(demoFile, &fs) == 0)
{
this->SetDemoPath(newPath);
found = 1;
}
delete[] demoFile;
delete[] newPath;
}
delete[] demoFile;
delete[] newPath;
util->Delete();
#endif // _WIN32
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment