Corrected YAML file parsing
* Fixes #2323. * YAML file parsing will now properly catch and display warnings when unable to read a file. Thanks to @CairoLee!
This commit is contained in:
parent
4a28c8c1b0
commit
dcbb2df776
2
3rdparty/yaml-cpp/src/parse.cpp
vendored
2
3rdparty/yaml-cpp/src/parse.cpp
vendored
@ -31,7 +31,7 @@ Node Load(std::istream& input) {
|
||||
|
||||
Node LoadFile(const std::string& filename) {
|
||||
std::ifstream fin(filename.c_str());
|
||||
if (!fin) {
|
||||
if (fin.bad()) {
|
||||
throw BadFile();
|
||||
}
|
||||
return Load(fin);
|
||||
|
@ -47,6 +47,8 @@ yamlwrapper* yaml_load_file(const char* file_name) {
|
||||
node = YAML::LoadFile(file_name);
|
||||
if (!node.IsDefined())
|
||||
return NULL;
|
||||
if (node.IsNull())
|
||||
return NULL;
|
||||
} catch (YAML::ParserException &e) {
|
||||
ShowError("YAML Exception Caught: %s\n", e.what());
|
||||
return NULL;
|
||||
|
Loading…
x
Reference in New Issue
Block a user