From fa881e903410daea62eaab2c3d8470fd4d913882 Mon Sep 17 00:00:00 2001 From: Ethan Holz Date: Sat, 23 Dec 2023 16:55:07 -0700 Subject: [PATCH] fix: fixed printing of ANISOU records --- src/records.zig | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/records.zig b/src/records.zig index f436ff6..bbad5f0 100644 --- a/src/records.zig +++ b/src/records.zig @@ -397,9 +397,15 @@ const AnisotropicLine = extern struct { anisotropic.u02 = try std.fmt.parseInt(i32, strings.removeSpaces(&self.u02), 10); anisotropic.u12 = try std.fmt.parseInt(i32, strings.removeSpaces(&self.u12), 10); if (len > 76) { - anisotropic.element = try allocator.dupe(u8, strings.removeSpaces(&self.element)); + const element = strings.removeSpaces(&self.element); + if (element.len != 0) { + anisotropic.element = try allocator.dupe(u8, element); + } if (len == 80) { - anisotropic.charge = try allocator.dupe(u8, strings.removeSpaces(&self.charge)); + const charge = strings.removeSpaces(&self.charge); + if (charge.len != 0) { + anisotropic.charge = try allocator.dupe(u8, strings.removeSpaces(&self.charge)); + } } } return anisotropic; -- 2.51.2