Add asserts to ensure operations not passed bad pointers

This commit is contained in:
Vincent Sanders 2015-07-09 17:43:21 +01:00
parent cd1949bc96
commit 5b09363597
1 changed files with 4 additions and 0 deletions

View File

@ -1554,6 +1554,8 @@ nserror nsurl_get(const nsurl *url, nsurl_component parts,
struct nsurl_component_lengths str_len = { 0, 0, 0, 0, 0, 0, 0, 0 };
enum nsurl_string_flags str_flags = 0;
assert(url != NULL);
/* Get the string length and find which parts of url need copied */
nsurl__get_string_data(&(url->components), parts, url_l,
&str_len, &str_flags);
@ -1704,6 +1706,8 @@ const char *nsurl_access_leaf(const nsurl *url)
const char *path;
const char *leaf;
assert(url != NULL);
if (url->components.path == NULL)
return "";