aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid G <kestral246@gmail.com>2019-05-25 18:01:55 +0200
committerSmallJoker <mk939@ymail.com>2019-05-25 18:01:55 +0200
commit40dadecb6ece6c9bbf7739e3a44ace25c0716dec (patch)
tree41881d875cbc98a84944a46e0437c6eff4014695
parent627a96cd9994cd75d490149f6e4a646c6eee3a3c (diff)
downloadminetest-40dadecb6ece6c9bbf7739e3a44ace25c0716dec.tar.gz
minetest-40dadecb6ece6c9bbf7739e3a44ace25c0716dec.tar.bz2
minetest-40dadecb6ece6c9bbf7739e3a44ace25c0716dec.zip
override.txt: Fix crash due to CRLF endings (#8439)
-rw-r--r--src/nodedef.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/nodedef.cpp b/src/nodedef.cpp
index 83e3968c3..2ffdf2fc2 100644
--- a/src/nodedef.cpp
+++ b/src/nodedef.cpp
@@ -1300,8 +1300,11 @@ void NodeDefManager::applyTextureOverrides(const std::string &override_filepath)
int line_c = 0;
while (std::getline(infile, line)) {
line_c++;
- if (trim(line).empty())
+ // Also trim '\r' on DOS-style files
+ line = trim(line);
+ if (line.empty())
continue;
+
std::vector<std::string> splitted = str_split(line, ' ');
if (splitted.size() != 3) {
errorstream << override_filepath