From a3f0a559a52d839aff2d619753f7dd8db5376801 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 5 Sep 2011 16:27:54 +0900 Subject: [PATCH] Fix a segfault when centerprinting. The dstring wasn't getting initialized :/ --- qw/include/client.h | 2 ++ qw/source/cl_main.c | 3 +++ qw/source/cl_parse.c | 4 ---- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/qw/include/client.h b/qw/include/client.h index 722c4987a..837b6dfc9 100644 --- a/qw/include/client.h +++ b/qw/include/client.h @@ -381,4 +381,6 @@ void CL_RSShot_f (void); #define RSSHOT_WIDTH 320 #define RSSHOT_HEIGHT 200 +extern struct dstring_s *centerprint; + #endif // _CLIENT_H diff --git a/qw/source/cl_main.c b/qw/source/cl_main.c index f4d945e73..b4fbc38b9 100644 --- a/qw/source/cl_main.c +++ b/qw/source/cl_main.c @@ -433,6 +433,8 @@ CL_ClearState (void) // clear other arrays memset (cl_efrags, 0, sizeof (cl_efrags)); memset (r_lightstyle, 0, sizeof (r_lightstyle)); + + dstring_clearstr (centerprint); } /* @@ -1751,6 +1753,7 @@ Host_Init (void) pr_gametype = "quakeworld"; + centerprint = dstring_newstr (); cls.userinfo = Info_ParseString ("", MAX_INFO_STRING, 0); cls.servername = dstring_newstr (); cls.downloadtempname = dstring_newstr (); diff --git a/qw/source/cl_parse.c b/qw/source/cl_parse.c index 0c9243ae0..b80d53e1e 100644 --- a/qw/source/cl_parse.c +++ b/qw/source/cl_parse.c @@ -1217,10 +1217,6 @@ CL_ServerInfo (void) // movevars.ktjump = atof (value); // FIXME: need to set to 0.5 otherwise, outside of else structure } - if (!centerprint) - centerprint = dstring_newstr (); - else - dstring_clearstr (centerprint); } static void