summaryrefslogtreecommitdiffstats
path: root/generic/tclEncoding.c
diff options
context:
space:
mode:
authorsebres <sebres@users.sourceforge.net>2025-08-25 16:42:09 (GMT)
committersebres <sebres@users.sourceforge.net>2025-08-25 16:42:09 (GMT)
commit5860f82135ef9563e1dd60b1c00daeedb1767c7d (patch)
tree8574588bc89a33d126f7dee80aab454359a233a2 /generic/tclEncoding.c
parenta4b27124be697f98b62986258b44d1f0fdf3e697 (diff)
downloadtcl-5860f82135ef9563e1dd60b1c00daeedb1767c7d.zip
tcl-5860f82135ef9563e1dd60b1c00daeedb1767c7d.tar.gz
tcl-5860f82135ef9563e1dd60b1c00daeedb1767c7d.tar.bz2
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
Diffstat (limited to 'generic/tclEncoding.c')
-rw-r--r--generic/tclEncoding.c8
1 files 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);