diff options
author | Andras Timar <andras.timar@collabora.com> | 2022-11-07 14:29:09 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2023-01-16 17:31:45 +0100 |
commit | 4a9cc6938b5abe59303b15cb826204035b910df3 (patch) | |
tree | f7c618b2bc170ae7a5eab2d75850a149327ba9ee /comphelper | |
parent | a53581f09b7df2b9e639318d10dd5a0aec7eb600 (diff) |
NSS initialization guard
Change-Id: I61a5886d0d13eaef6a61479e35d52a85937075ed
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142385
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Henry Castro <hcastro@collabora.com>
Diffstat (limited to 'comphelper')
-rw-r--r-- | comphelper/source/misc/hash.cxx | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/comphelper/source/misc/hash.cxx b/comphelper/source/misc/hash.cxx index 9fab6028a659..0fb2ef28c461 100644 --- a/comphelper/source/misc/hash.cxx +++ b/comphelper/source/misc/hash.cxx @@ -77,11 +77,15 @@ struct HashImpl { #if USE_TLS_NSS - auto const e = NSS_NoDB_Init(nullptr); - if (e != SECSuccess) { - PRErrorCode error = PR_GetError(); - const char* errorText = PR_ErrorToName(error); - throw css::uno::RuntimeException("NSS_NoDB_Init failed with " + OUString(errorText, strlen(errorText), RTL_TEXTENCODING_UTF8) + " (" + OUString::number((int) error) + ")"); + if (!NSS_IsInitialized()) + { + auto const e = NSS_NoDB_Init(nullptr); + if (e != SECSuccess) + { + PRErrorCode error = PR_GetError(); + const char* errorText = PR_ErrorToName(error); + throw css::uno::RuntimeException("NSS_NoDB_Init failed with " + OUString(errorText, strlen(errorText), RTL_TEXTENCODING_UTF8) + " (" + OUString::number((int) error) + ")"); + } } mpContext = HASH_Create(getNSSType()); HASH_Begin(mpContext); |