From 882320c64486ae8d338750786f136ba878bd409d Mon Sep 17 00:00:00 2001 From: Caleb Krause Date: Sat, 4 Apr 2026 20:15:24 -0500 Subject: [PATCH] Fix a crash when parsing empty comments --- happly.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/happly.h b/happly.h index 4ee8c71..d633f40 100644 --- a/happly.h +++ b/happly.h @@ -1759,6 +1759,8 @@ class PLYData { // Parse a comment if (startsWith(line, "comment")) { + // Skip the comment if it's empty + if (line.length() <= 8) continue; string comment = line.substr(8); if (verbose) cout << " - Comment: " << comment << endl; comments.push_back(comment); @@ -1767,6 +1769,8 @@ class PLYData { // Parse an obj_info comment if (startsWith(line, "obj_info")) { + // Skip the comment if it's empty + if (line.length() <= 9) continue; string infoComment = line.substr(9); if (verbose) cout << " - obj_info: " << infoComment << endl; objInfoComments.push_back(infoComment);