diff --git a/src/ccstruct/fontinfo.cpp b/src/ccstruct/fontinfo.cpp index 9395ebfb8a..65d4d032e1 100644 --- a/src/ccstruct/fontinfo.cpp +++ b/src/ccstruct/fontinfo.cpp @@ -221,7 +221,8 @@ bool write_spacing_info(FILE *f, const FontInfo &fi) { bool write_set(FILE *f, const FontSet &fs) { int size = fs.size(); - return tesseract::Serialize(f, &size) && tesseract::Serialize(f, &fs[0], size); + return tesseract::Serialize(f, &size) && + (size > 0 ? tesseract::Serialize(f, &fs[0], size) : true); } } // namespace tesseract.