desktop/source/app/crashreport.cxx | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
New commits: commit c2319b41261ae13c222231a16274334dc8971f2d Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Sun Dec 6 10:29:46 2020 +0100 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Sun Dec 6 13:21:13 2020 +0100 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 <sberg...@redhat.com> 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 } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits