Skip to content

Commit

Permalink
Don't load or validate apikeys if SC_NO_NETWORKING is defined
Browse files Browse the repository at this point in the history
  • Loading branch information
navv1234 committed Jan 10, 2019
1 parent 072b13f commit bfff0fd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 3 additions & 2 deletions engine/interfaces/sc_http.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -535,8 +535,9 @@ int http::get( std::string& result,
}
}

// No result from the download process, grab it from the cache
if ( result.empty() )
// No result from the download process, grab it from the cache, only if the download process was
// returned OK status.
if ( result.empty() && response_code == 200 )
{
result = entry.result;
}
Expand Down
8 changes: 6 additions & 2 deletions engine/sim/sc_sim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1023,6 +1023,7 @@ struct regen_event_t : public event_t
}
};

#ifndef SC_NO_NETWORKING
/// List of files from which to look for Blizzard API key
std::vector<std::string> get_api_key_locations()
{
Expand Down Expand Up @@ -1093,11 +1094,12 @@ std::string get_api_key()
}
}

#if defined(SC_DEFAULT_APIKEY)
#if defined( SC_DEFAULT_APIKEY )
return std::string(SC_DEFAULT_APIKEY);
#endif
#endif /* SC_DEFAULT_APIKEY */
return std::string();
}
#endif /* SC_NO_NETWORKING */

/// Setup a periodic check for Bloodlust
struct bloodlust_check_t : public event_t
Expand Down Expand Up @@ -1399,7 +1401,9 @@ sim_t::sim_t() :
solo_raid( false ),
global_item_upgrade_level( 0 ),
maximize_reporting( false ),
#ifndef SC_NO_NETWORKING
apikey( get_api_key() ),
#endif
distance_targeting_enabled( false ),
ignore_invulnerable_targets( false ),
enable_dps_healing( false ),
Expand Down

0 comments on commit bfff0fd

Please sign in to comment.