SDL_ttf, Ubuntu 18.4, rendering gobbledygook

I have my first attempt using SDL2 in a thing I call “lame-game”:

All the SDL_ttf related code is in a class Calle Score:

Note that this runs in a game loop so Score::Update() is called before Score::Render() each cycle.

It all builds and runs fine in macOS but on Ubuntu 18.4 LTS the font doesn’t render. I get a “text is zero width” error and the app either crashes with a segmentation fault, or just displays gobbledygook in place of the text.

I’m running macOS Catalina 10.15 and Ubuntu 18.4 LTS on Virtualbox.

confused,
-chris

Why aren’t you verifying that TTF_OpenFont() returns a non-NULL pointer before using it in TTF_RenderUTF8_Solid()?

Uh. Because I’m learning? :slight_smile:

Thanks. I’ll try that

I added a null check as @Charles_Huber suggested. Apparently TTF_OpenFont() doesn’t return NULL. So it’s the same… Thanks for the review though!