Index: source/ps/XML/Xeromyces.cpp =================================================================== --- source/ps/XML/Xeromyces.cpp +++ source/ps/XML/Xeromyces.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2015 Wildfire Games. +/* Copyright (C) 2018 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -173,10 +173,12 @@ return PSRETURN_Xeromyces_XMLParseError; } + bool valid = true; { CScopeLock lock(g_ValidatorCacheLock); RelaxNGValidator& validator = GetValidator(validatorName); - if (validator.CanValidate() && !validator.ValidateEncoded(doc)) + valid = !validator.CanValidate() || validator.ValidateEncoded(doc); + if (!valid) // For now, log the error and continue, in the future we might fail LOGERROR("CXeromyces: failed to validate XML file %s", filename.string8()); } @@ -186,8 +188,10 @@ xmlFreeDoc(doc); - // Save the file to disk, so it can be loaded quickly next time - vfs->CreateFile(xmbPath, writeBuffer.Data(), writeBuffer.Size()); + // Save the file to disk, so it can be loaded quickly next time. + // Don't save if invalid, because we want the syntax error every program start. + if (valid) + vfs->CreateFile(xmbPath, writeBuffer.Data(), writeBuffer.Size()); m_XMBBuffer = writeBuffer.Data(); // add a reference