Exception thrown at 0x71002A85 (SDL2_ttf.dll)
<p>So i'm creating a 2D Pong game using SDL2 and C++ (I'm completely new to this!) Everything was going well until I hit this error: </p>

<pre><code>Exception thrown at 0x71002A85 (SDL2_ttf.dll) in 2D Game.exe: 0xC0000005: Access violation reading location 0x00000000.
</code></pre>

<p>the code breaks at:</p>

<p>SDL_Surface* surf = TTF_RenderText_Blended(font, message.c_str(), color);</p>

<pre><code>#include "utilities.h"

#include &lt;SDL.h&gt;
#include &lt;SDL_ttf.h&gt;

void renderTexture(SDL_Texture* tex,
        SDL_Renderer* ren, SDL_Rect dst, SDL_Rect *clip) {
    SDL_RenderCopy(ren, tex, clip, &amp;dst);
}

void renderTexture(SDL_Texture* tex,
        SDL_Renderer* ren, int x, int y, SDL_Rect* clip) {
    SDL_Rect dst;
    dst.x = x;
    dst.y = y;
    if (clip != nullptr) {
        dst.w = clip-&gt;w;
        dst.h = clip-&gt;h;
    } else {
        SDL_QueryTexture(tex, nullptr, nullptr, &amp;dst.w, &amp;dst.h);
    }

    renderTexture(tex, ren, dst, clip);
}

SDL_Texture* renderText(const std::string &amp;message,
    const std::string &amp;fontFile, SDL_Color color,
    int fontSize, SDL_Renderer* renderer) {

    TTF_Font* font = TTF_OpenFont(fontFile.c_str(), fontSize);

SDL_Surface* surf = TTF_RenderText_Blended(font, message.c_str(), color);

SDL_Texture* texture = SDL_CreateTextureFromSurface(renderer, surf);

SDL_FreeSurface(surf);
TTF_CloseFont(font);

return texture;

}
</code></pre>