summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2020-12-06 10:29:46 +0100
committerStephan Bergmann <sbergman@redhat.com>2020-12-06 13:21:13 +0100
commitc2319b41261ae13c222231a16274334dc8971f2d (patch)
treebb804e9dc079f207556ba61f98d46e52baefad4d /desktop
parent30d2b76e0ed081bed545820e459af56e45fecbdd (diff)
Clean up CrashReporter::IsDumpEnable
...avoiding construction of an OString from a potentially null pointer, which relied on undocumented behavior of the OString ctor Change-Id: I8f65375ba29cf345b35409019a39de1bac397625 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107278 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'desktop')
-rw-r--r--desktop/source/app/crashreport.cxx15
1 files changed, 8 insertions, 7 deletions
diff --git a/desktop/source/app/crashreport.cxx b/desktop/source/app/crashreport.cxx
index 432be67cdcd3..3689613cb359 100644
--- a/desktop/source/app/crashreport.cxx
+++ b/desktop/source/app/crashreport.cxx
@@ -222,16 +222,17 @@ void CrashReporter::removeExceptionHandler()
bool CrashReporter::IsDumpEnable()
{
- OUString sToken;
- OString sEnvVar(std::getenv("CRASH_DUMP_ENABLE"));
- bool bEnable = true; // default, always on
+ auto const env = std::getenv("CRASH_DUMP_ENABLE");
+ if (env != nullptr && env[0] != '\0') {
+ return true;
+ }
// read configuration item 'CrashDumpEnable' -> bool on/off
- if (rtl::Bootstrap::get("CrashDumpEnable", sToken) && sEnvVar.isEmpty())
+ OUString sToken;
+ if (rtl::Bootstrap::get("CrashDumpEnable", sToken))
{
- bEnable = sToken.toBoolean();
+ return sToken.toBoolean();
}
-
- return bEnable;
+ return true; // default, always on
}