Skip to content

Commit

Permalink
Display: exit render_scaled_to_zoom early if passed texture is null
Browse files Browse the repository at this point in the history
  • Loading branch information
Vultraz committed Jul 22, 2017
1 parent 4e2c1ce commit b09d965
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/display.hpp
Expand Up @@ -898,6 +898,10 @@ class display : public filter_context, public video2::draw_layering
template<typename... T>
void render_scaled_to_zoom(const texture& tex, const int x_pos, const int y_pos, T&&... extra_args) const
{
if(tex.null()) {
return;
}

texture::info info = tex.get_info();

// Scale the coordinates to the appropriate zoom factor.
Expand Down Expand Up @@ -925,6 +929,10 @@ class display : public filter_context, public video2::draw_layering
template<typename... T>
void render_scaled_to_zoom(const texture& tex, const map_location& loc, T&&... extra_args) const
{
if(tex.null()) {
return;
}

SDL_Point origin = get_loc_drawing_origin(loc);

render_scaled_to_zoom(tex, origin.x, origin.y, std::forward<T>(extra_args)...);
Expand Down

0 comments on commit b09d965

Please sign in to comment.