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 Jan 27, 2025
1 parent 6f0ae18 commit 7665d8b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/libical/icalproperty.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,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
10 changes: 8 additions & 2 deletions src/libical/icalvalue.c
Original file line number Diff line number Diff line change
Expand Up @@ -1246,9 +1246,15 @@ char *icalvalue_as_ical_string_r(const icalvalue *value)
case ICAL_NO_VALUE:
_fallthrough();

default: {
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 7665d8b

Please sign in to comment.