Fix a crash in _winreg_QueryValue