From 5ada91f026a40c8e71b4864be678a539088a718f Mon Sep 17 00:00:00 2001 From: krangelov Date: Thu, 18 Nov 2021 11:36:18 +0100 Subject: [PATCH] fix the serialization for empty strings --- src/runtime/c/pgf/writer.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/runtime/c/pgf/writer.cxx b/src/runtime/c/pgf/writer.cxx index 38a4aad24..d6c170931 100644 --- a/src/runtime/c/pgf/writer.cxx +++ b/src/runtime/c/pgf/writer.cxx @@ -112,7 +112,7 @@ void PgfWriter::write_name(PgfText *text) size_t n_items = fwrite(&text->text, text->size, 1, out); if (ferror(out)) throw pgf_error("an error occured while writing out the grammar"); - if (n_items != 1) + if (text->size != 0 && n_items != 1) throw pgf_error("couldn't write to the output file"); } @@ -128,7 +128,7 @@ void PgfWriter::write_text(PgfText *text) size_t n_items = fwrite(&text->text, text->size, 1, out); if (ferror(out)) throw pgf_error("an error occured while writing out the grammar"); - if (n_items != 1) + if (text->size != 0 && n_items != 1) throw pgf_error("couldn't write to the output file"); }