From b80b176d8503eda0308a925184f39ad6a9630fd2 Mon Sep 17 00:00:00 2001 From: Jason Beverage Date: Thu, 16 May 2024 11:11:24 -0400 Subject: [PATCH] Checking to see if the profile string might be JSON before parsing it. Fixes #2509 --- src/osgEarth/MBTiles.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/osgEarth/MBTiles.cpp b/src/osgEarth/MBTiles.cpp index a399bfa278..1aeebb45fb 100644 --- a/src/osgEarth/MBTiles.cpp +++ b/src/osgEarth/MBTiles.cpp @@ -526,10 +526,14 @@ MBTiles::Driver::open( { if (!profileStr.empty()) { - // try to parse it as a JSON config - Config pconf; - pconf.fromJSON(profileStr); - profile = Profile::create(ProfileOptions(pconf)); + // See if the profile string is JSON + if (profileStr.find("{") != std::string::npos) + { + // try to parse it as a JSON config + Config pconf; + pconf.fromJSON(profileStr); + profile = Profile::create(ProfileOptions(pconf)); + } // if that didn't work, try parsing it directly if (!profile)