Need help with SDL error

I recently started over on a project I was doing in SDL so I created a new project but now I'm getting this really weird access violation error when I try to display text with SDL:

Unhandled exception at 0x6f4c2a9d in development.exe: 0xC0000005: Access violation reading location 0x00000000

I get this at

#include "SDL.h"
#include "SDL_TTF.h"

void drawText(SDL_Surface* screen, char* string, int size, int x, int y, int fR, int fG, int fB, int bR, int bG, int bB)

TTF_Font* font = TTF_OpenFont("ARIAL.TTF", size);
SDL_Color foregroundColor = { fR, fG, fB };
SDL_Color backgroundColor = { bR, bG, bB };
SDL_Surface* textSurface = TTF_RenderText_Shaded(font, string,

*before this next line is executed*************************************

foregroundColor, backgroundColor);
SDL_Rect textLocation = { x, y, 0, 0 };
SDL_BlitSurface(textSurface, NULL, screen, &textLocation);

And I know this is perfectly good code, in fact I can take all my current code from this project and put it in my old project and it executes fine.

I've checked all the settings and everything and made sure all my includes were right but I'm sure I must be missing something here ?? =[

Also I looked online and they said that code meant I was derefferencing a null pointer but that didn't help me fix the error
Topic archived. No new replies allowed.