mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-22 03:55:11 +00:00
Sanity check FPS Display to prevent crash
This commit is contained in:
parent
c509dab0cf
commit
7a9d32551c
2 changed files with 3 additions and 4 deletions
|
@ -283,7 +283,6 @@ static void djui_base_render_border(struct DjuiBase* base) {
|
|||
////////////
|
||||
|
||||
bool djui_base_render(struct DjuiBase* base) {
|
||||
if (base == NULL) { return false; }
|
||||
if (!base->visible) { return false; }
|
||||
|
||||
if (base->on_render_pre != NULL) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "djui.h"
|
||||
#include "../pc_main.h"
|
||||
#include "pc/pc_main.h"
|
||||
|
||||
struct DjuiFpsDisplay {
|
||||
struct DjuiText *text;
|
||||
|
@ -9,7 +9,7 @@ struct DjuiFpsDisplay {
|
|||
struct DjuiFpsDisplay *sFpsDisplay = NULL;
|
||||
|
||||
void djui_fps_display_update(u16 fps) {
|
||||
if (configShowFPS) {
|
||||
if (configShowFPS && sFpsDisplay != NULL) {
|
||||
char fpsText[30] = "";
|
||||
snprintf(fpsText, 30, "\\#dcdcdc\\FPS: \\#ffffff\\%d", fps);
|
||||
djui_text_set_text(sFpsDisplay->text, fpsText);
|
||||
|
@ -17,7 +17,7 @@ void djui_fps_display_update(u16 fps) {
|
|||
}
|
||||
|
||||
void djui_fps_display_render(void) {
|
||||
if (configShowFPS) {
|
||||
if (configShowFPS && sFpsDisplay != NULL) {
|
||||
djui_rect_render(&sFpsDisplay->base);
|
||||
djui_base_render(&sFpsDisplay->base);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue