Skip to content

Commit b926c9c

Browse files
committed
Revert "parse: No need to NULL guard lwc_string_unref"
This reverts commit b0f4587.
1 parent 6be2a96 commit b926c9c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/parse/language.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,8 @@ css_error css__language_destroy(css_language *language)
169169
if (language == NULL)
170170
return CSS_BADPARM;
171171

172-
lwc_string_unref(language->default_namespace);
172+
if (language->default_namespace != NULL)
173+
lwc_string_unref(language->default_namespace);
173174

174175
if (language->namespaces != NULL) {
175176
for (i = 0; i < language->num_namespaces; i++) {
@@ -854,7 +855,8 @@ css_error addNamespace(css_language *c, lwc_string *prefix, lwc_string *uri)
854855
{
855856
if (prefix == NULL) {
856857
/* Replace default namespace */
857-
lwc_string_unref(c->default_namespace);
858+
if (c->default_namespace != NULL)
859+
lwc_string_unref(c->default_namespace);
858860

859861
/* Special case: if new namespace uri is "", use NULL */
860862
if (lwc_string_length(uri) == 0)
@@ -890,7 +892,8 @@ css_error addNamespace(css_language *c, lwc_string *prefix, lwc_string *uri)
890892
}
891893

892894
/* Replace namespace URI */
893-
lwc_string_unref(c->namespaces[idx].uri);
895+
if (c->namespaces[idx].uri != NULL)
896+
lwc_string_unref(c->namespaces[idx].uri);
894897

895898
/* Special case: if new namespace uri is "", use NULL */
896899
if (lwc_string_length(uri) == 0)

0 commit comments

Comments
 (0)