From 89ea0548ef3ac9d5773cf0037b9e16d772a350c7 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Wed, 13 Apr 2022 14:58:33 -0400 Subject: [PATCH] Trim whitespace around parent indices This prevents a bug where whitespace could accidentally delete some parents. --- src/havokxmlparser.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/havokxmlparser.cpp b/src/havokxmlparser.cpp index 06a387b..289d3f2 100644 --- a/src/havokxmlparser.cpp +++ b/src/havokxmlparser.cpp @@ -56,6 +56,8 @@ Skeleton parseHavokXML(const std::string_view path) { pugi::xpath_node parentNode = doc.select_node("//hkparam[@name=\"parentIndices\"]"); std::string text = parentNode.node().text().as_string(); + std::replace(text.begin(), text.end(), '\n', ' '); + text.erase(std::remove(text.begin(), text.end(), '\t'), text.end()); auto parentIndices = tokenize(text, " ");