Raise an exception for empty url schemes

This commit is contained in:
Kovid Goyal 2022-02-06 21:10:41 +05:30
parent eedc849c45
commit 1358f00969
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -835,7 +835,10 @@ cocoa_set_url_handler(PyObject UNUSED *self, PyObject *args) {
const char *url_scheme = NULL, *bundle_id = NULL;
if (!PyArg_ParseTuple(args, "s|z", &url_scheme, &bundle_id)) return NULL;
if (!url_scheme || url_scheme[0] == '\0') Py_RETURN_FALSE;
if (!url_scheme || url_scheme[0] == '\0') {
PyErr_SetString(PyExc_TypeError, "Empty url scheme");
return NULL;
}
NSString *scheme = [NSString stringWithUTF8String:url_scheme];
NSString *identifier = @"";