Commit c9631f75 authored by David E. DeMarle's avatar David E. DeMarle Committed by Kitware Robot

Merge topic 'fix-paraview-crash-on-mac' into paraview/release

94d45b88 avoid exceptions to prevent a crash on Mac
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Acked-by: Allison Vacanti's avatarAllison Vacanti <allison.vacanti@kitware.com>
Merge-request: !4442
parents 47bdc3cd 94d45b88
......@@ -131,30 +131,31 @@ bool vtkOSPRayMaterialLibrary::InternalParse
} else {
doc = new std::istringstream(filename);
}
bool retOK = false;
if (std::string(filename).rfind(".mtl") != std::string::npos)
{
return this->InternalParseMTL(filename, fromfile, doc);
}
return this->InternalParseJSON(filename, fromfile, doc);
{
retOK = this->InternalParseMTL(filename, fromfile, doc);
}
else
{
retOK = this->InternalParseJSON(filename, fromfile, doc);
}
delete doc;
return retOK;
}
// ----------------------------------------------------------------------------
bool vtkOSPRayMaterialLibrary::InternalParseJSON
(const char *filename, bool fromfile, std::istream *doc)
{
//todo: this reader is a lot more fragile then I'ld like, need to make it robust
Json::Value root;
try
{
*doc >> root;
}
catch (Json::RuntimeError)
std::string errs;
Json::CharReaderBuilder jreader;
bool ok = Json::parseFromStream(jreader, *doc, &root, &errs);
if (!ok)
{
delete doc;
return false;
}
delete doc;
if (!root.isMember("family"))
{
vtkErrorMacro("Not a materials file. Must have \"family\"=\"...\" entry.");
......
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