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 Aug 12, 2017
1 parent 264d2ad commit a35397d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/display.hpp
Expand Up @@ -901,6 +901,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 @@ -928,6 +932,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 a35397d

Please sign in to comment.