Skip to content

Commit

Permalink
Follow up to dcbb2df
Browse files Browse the repository at this point in the history
* Adjusted the checks to one-line.
* Corrected the map-server from spitting out an error for the achievements import file.
  • Loading branch information
aleos89 committed Aug 9, 2017
1 parent dcbb2df commit ac1cf04
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion 3rdparty/yaml-cpp/src/parse.cpp
Expand Up @@ -31,7 +31,7 @@ Node Load(std::istream& input) {

Node LoadFile(const std::string& filename) {
std::ifstream fin(filename.c_str());
if (fin.bad()) {
if (!fin || fin.bad()) {
throw BadFile();
}
return Load(fin);
Expand Down
2 changes: 2 additions & 0 deletions db/import-tmpl/achievement_db.yml
Expand Up @@ -76,3 +76,5 @@
###########################################################################
# Score - Achievement points that are given on completion.
###########################################################################

Achievements:
4 changes: 1 addition & 3 deletions src/common/yamlwrapper.cpp
Expand Up @@ -45,9 +45,7 @@ yamlwrapper* yaml_load_file(const char* file_name) {

try {
node = YAML::LoadFile(file_name);
if (!node.IsDefined())
return NULL;
if (node.IsNull())
if (!node.IsDefined() || node.IsNull())
return NULL;
} catch (YAML::ParserException &e) {
ShowError("YAML Exception Caught: %s\n", e.what());
Expand Down

2 comments on commit ac1cf04

@CairoLee
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still crash, information is Unhandled exception at 0x77B8A9F2 in map-server.exe: Microsoft C++ exception: YAML::BadFile at memory location 0x005AEFE8.

@CairoLee
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in my case, the fin is not NULL or 0x0000000, it's like 0xccccccce

Please sign in to comment.