From 5860f82135ef9563e1dd60b1c00daeedb1767c7d Mon Sep 17 00:00:00 2001 From: sebres Date: Mon, 25 Aug 2025 16:42:09 +0000 Subject: amend to [0433b67adc] (ticket [87b69745be]): don't return with OK (swallow the error) if encoding cannot be loaded, and current system encoding is NULL for whatever reason --- generic/tclEncoding.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index 43566ce..cbd2dc0 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -996,15 +996,15 @@ Tcl_SetSystemEncoding( ((Encoding *)encoding)->refCount += 1; } else { encoding = Tcl_GetEncoding(interp, name); + if (encoding == NULL) { + Tcl_MutexUnlock(&encodingMutex); + return TCL_ERROR; + } if (encoding == systemEncoding) { FreeEncoding(encoding); Tcl_MutexUnlock(&encodingMutex); return TCL_OK; } - if (encoding == NULL) { - Tcl_MutexUnlock(&encodingMutex); - return TCL_ERROR; - } } assert(encoding != systemEncoding); -- cgit v0.12