Skip to content
Snippets Groups Projects
Commit bb757b93 authored by Nat Goodspeed's avatar Nat Goodspeed
Browse files

SL-820: gDirUtilp is never nullptr.

It might point to an uninitialized LLDir, but that's a whole separate problem,
one that wouldn't be detected by checking for nullptr. If we hit that, time to
change to an LLSingleton.
parent 24e71a45
No related branches found
No related tags found
No related merge requests found
...@@ -565,61 +565,54 @@ bool LLAppViewerWin32::init() ...@@ -565,61 +565,54 @@ bool LLAppViewerWin32::init()
#else // LL_BUGSPLAT #else // LL_BUGSPLAT
if (! gDirUtilp) std::string build_data_fname(
gDirUtilp->getExpandedFilename(LL_PATH_EXECUTABLE, "build_data.json"));
std::ifstream inf(build_data_fname.c_str());
if (! inf.is_open())
{ {
LL_WARNS() << "Can't initialize BugSplat, gDirUtilp not yet set" << LL_ENDL; LL_WARNS() << "Can't initialize BugSplat, can't read '" << build_data_fname
<< "'" << LL_ENDL;
} }
else else
{ {
std::string build_data_fname( Json::Reader reader;
gDirUtilp->getExpandedFilename(LL_PATH_EXECUTABLE, "build_data.json")); Json::Value build_data;
std::ifstream inf(build_data_fname.c_str()); if (! reader.parse(inf, build_data, false)) // don't collect comments
if (! inf.is_open())
{ {
LL_WARNS() << "Can't initialize BugSplat, can't read '" << build_data_fname // gah, the typo is baked into their API
<< "'" << LL_ENDL; LL_WARNS() << "Can't initialize BugSplat, can't parse '" << build_data_fname
<< "': " << reader.getFormatedErrorMessages() << LL_ENDL;
} }
else else
{ {
Json::Reader reader; Json::Value BugSplat_DB = build_data["BugSplat DB"];
Json::Value build_data; if (! BugSplat_DB)
if (! reader.parse(inf, build_data, false)) // don't collect comments
{ {
// gah, the typo is baked into their API LL_WARNS() << "Can't initialize BugSplat, no 'BugSplat DB' entry in '"
LL_WARNS() << "Can't initialize BugSplat, can't parse '" << build_data_fname << build_data_fname << "'" << LL_ENDL;
<< "': " << reader.getFormatedErrorMessages() << LL_ENDL;
} }
else else
{ {
Json::Value BugSplat_DB = build_data["BugSplat DB"]; // Got BugSplat_DB, onward!
if (! BugSplat_DB) std::wstring version_string(WSTRINGIZE(LL_VIEWER_VERSION_MAJOR << '.' <<
{ LL_VIEWER_VERSION_MINOR << '.' <<
LL_WARNS() << "Can't initialize BugSplat, no 'BugSplat DB' entry in '" LL_VIEWER_VERSION_PATCH << '.' <<
<< build_data_fname << "'" << LL_ENDL; LL_VIEWER_VERSION_BUILD));
}
else // have to convert normal wide strings to strings of __wchar_t
{ sBugSplatSender = new MiniDmpSender(
// Got BugSplat_DB, onward! wunder(BugSplat_DB.asString()).c_str(),
std::wstring version_string(WSTRINGIZE(LL_VIEWER_VERSION_MAJOR << '.' << wunder(LL_TO_WSTRING(LL_VIEWER_CHANNEL)).c_str(),
LL_VIEWER_VERSION_MINOR << '.' << wunder(version_string).c_str(),
LL_VIEWER_VERSION_PATCH << '.' << nullptr);
LL_VIEWER_VERSION_BUILD)); sBugSplatSender->setCallback(bugsplatSendLog);
// have to convert normal wide strings to strings of __wchar_t // engage stringize() overload that converts from wstring
sBugSplatSender = new MiniDmpSender( LL_INFOS() << "Engaged BugSplat(" << LL_TO_STRING(LL_VIEWER_CHANNEL)
wunder(BugSplat_DB.asString()).c_str(), << stringize(version_string) << ')' << LL_ENDL;
wunder(LL_TO_WSTRING(LL_VIEWER_CHANNEL)).c_str(), } // got BugSplat_DB
wunder(version_string).c_str(), } // parsed build_data.json
nullptr); } // opened build_data.json
sBugSplatSender->setCallback(bugsplatSendLog);
// engage stringize() overload that converts from wstring
LL_INFOS() << "Engaged BugSplat(" << LL_TO_STRING(LL_VIEWER_CHANNEL)
<< stringize(version_string) << ')' << LL_ENDL;
} // got BugSplat_DB
} // parsed build_data.json
} // opened build_data.json
} // gDirUtilp set
#endif // LL_BUGSPLAT #endif // LL_BUGSPLAT
#endif // LL_SEND_CRASH_REPORTS #endif // LL_SEND_CRASH_REPORTS
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment