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 Oct 27, 2023
1 parent d66568a commit 6a81502
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/libical/icalproperty.c
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,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
7 changes: 7 additions & 0 deletions src/libical/icalvalue.c
Original file line number Diff line number Diff line change
Expand Up @@ -1233,7 +1233,14 @@ char *icalvalue_as_ical_string_r(const icalvalue *value)
case ICAL_NO_VALUE:
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 6a81502

Please sign in to comment.