From 1009a4f050cc6cf430a67cffb28de207448bad88 Mon Sep 17 00:00:00 2001 From: Frank LENORMAND Date: Sat, 18 Jul 2015 01:24:31 +0200 Subject: [PATCH] some fixes --- source/src/docs.cpp | 1 + source/src/server.cpp | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/source/src/docs.cpp b/source/src/docs.cpp index e891f72f..b1bbb10f 100644 --- a/source/src/docs.cpp +++ b/source/src/docs.cpp @@ -403,6 +403,7 @@ void renderdoc(int x, int y, int doch) if(!docvisible) return; char *exp = getcurcommand(); + if(!exp || !*exp) return; int o = 0; //offset int f = 0; //last found diff --git a/source/src/server.cpp b/source/src/server.cpp index 29a283d0..d596608e 100644 --- a/source/src/server.cpp +++ b/source/src/server.cpp @@ -2180,14 +2180,14 @@ void scallvotesuc(voteinfo *v) clients[v->owner]->lastvotecall = servmillis; clients[v->owner]->nvotes--; // successful votes do not count as abuse sendf(v->owner, 1, "ri", SV_CALLVOTESUC); - logline(ACLOG_INFO, "[%s] client %s called a vote: %s", clients[v->owner]->hostname, clients[v->owner]->name, v->action && v->action->desc ? v->action->desc : "[unknown]"); + logline(ACLOG_INFO, "[%s] client %s called a vote: %s", clients[v->owner]->hostname, clients[v->owner]->name, v->action && *v->action->desc ? v->action->desc : "[unknown]"); } void scallvoteerr(voteinfo *v, int error) { if(!valid_client(v->owner)) return; sendf(v->owner, 1, "ri2", SV_CALLVOTEERR, error); - logline(ACLOG_INFO, "[%s] client %s failed to call a vote: %s (%s)", clients[v->owner]->hostname, clients[v->owner]->name, v->action && v->action->desc ? v->action->desc : "[unknown]", voteerrorstr(error)); + logline(ACLOG_INFO, "[%s] client %s failed to call a vote: %s (%s)", clients[v->owner]->hostname, clients[v->owner]->name, v->action && *v->action->desc ? v->action->desc : "[unknown]", voteerrorstr(error)); } bool map_queued = false; @@ -2662,8 +2662,8 @@ void process(ENetPacket *packet, int sender, int chan) copystring(cl->pwd, text); getstring(text, p); filterlang(cl->lang, text); - int wantrole = getint(p); - cl->state.nextprimary = getint(p); + int wantrole = getint(p), np = getint(p); + cl->state.nextprimary = np > 0 && np < NUMGUNS ? np : GUN_ASSAULT; loopi(2) cl->skin[i] = getint(p); int bantype = getbantype(sender); bool banned = bantype > BAN_NONE; @@ -3457,7 +3457,7 @@ void process(ENetPacket *packet, int sender, int chan) if(mode==GMODE_DEMO) vi->action = new demoplayaction(newstring(text)); else { - char *vmap = newstring(vi->text ? behindpath(vi->text) : ""); + char *vmap = newstring(*vi->text ? behindpath(vi->text) : ""); vi->action = new mapaction(vmap, qmode, time, sender, qmode!=mode); } break;