[Bug 3606139]: missing error check allows regexp to crash Tcl. Thanks to Tom Lane for providing the test-case and the patch.