Skip to content

Commit

Permalink
icalvalue: return "" for NO_VALUE if ALLOW_EMPTY_PROPERTIES=true
Browse files Browse the repository at this point in the history
  • Loading branch information
brong authored and rsto committed Jul 1, 2024
1 parent 6d09bc8 commit 6645e05
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/libical/icalproperty.c
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,11 @@ const char *icalproperty_as_ical_string(icalproperty *prop)
char *buf;

buf = icalproperty_as_ical_string_r(prop);
#if ICAL_ALLOW_EMPTY_PROPERTIES
/* empty string is set to no-value, per commit b1a9eb33597028b2d160f289b6105f4aa67276a7
* which return NULL as the string value. Convert back to an empty string here */
if (!buf) return "";
#endif
icalmemory_add_tmp_buffer(buf);
return buf;
}
Expand Down
14 changes: 11 additions & 3 deletions src/libical/icalvalue.c
Original file line number Diff line number Diff line change
Expand Up @@ -1206,9 +1206,17 @@ char *icalvalue_as_ical_string_r(const icalvalue *value)
/* FALLTHRU */

case ICAL_NO_VALUE:
default: {
return 0;
}
default:
{
#if ICAL_ALLOW_EMPTY_PROPERTIES
/* empty string is set to no-value, per
* commit b1a9eb33597028b2d160f289b6105f4aa67276a7
* Convert back to an empty string here */
return icalmemory_strdup("");
#else
return 0;
#endif
}
}
}

Expand Down

0 comments on commit 6645e05

Please sign in to comment.