From ba28b56a6b3180c7d13c196ecb44fddd3d63a4f6 Mon Sep 17 00:00:00 2001 From: Haru Date: Wed, 7 Feb 2018 03:56:01 +0100 Subject: Fix some minor issues in the clan system, as reported by coverity Signed-off-by: Haru --- src/char/int_clan.c | 8 ++++---- src/map/atcommand.c | 10 ++-------- src/map/clan.c | 2 +- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/char/int_clan.c b/src/char/int_clan.c index 76a9639c5..c75f8f6e1 100644 --- a/src/char/int_clan.c +++ b/src/char/int_clan.c @@ -55,11 +55,11 @@ int inter_clan_kick_inactive_members(int clan_id, int kick_interval) { if (clan_id <= 0) { ShowError("inter_clan_kick_inactive_members: Invalid clan id received '%d'\n", clan_id); - Assert_retr(0, 0); + Assert_report(clan_id > 0); return 0; } else if (kick_interval <= 0) { ShowError("inter_clan_kick_inactive_members: Invalid kick_interval received '%d'", kick_interval); - Assert_retr(0, 0); + Assert_report(kick_interval > 0); return 0; } @@ -88,11 +88,11 @@ int inter_clan_count_members(int clan_id, int kick_interval) if (clan_id <= 0) { ShowError("inter_clan_count_members: Invalid clan id received '%d'\n", clan_id); - Assert_retr(0, 0); + Assert_report(clan_id > 0); return 0; } else if (kick_interval <= 0) { ShowError("inter_clan_count_member: Invalid kick_interval received '%d'", kick_interval); - Assert_retr(0, 0); + Assert_report(kick_interval > 0); return 0; } diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 29e8bf4f8..6b7606cb4 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -9545,9 +9545,6 @@ ACMD(claninfo) for (i = 0; i < VECTOR_LENGTH(c->allies); i++) { struct clan_relationship *ally = &VECTOR_INDEX(c->allies, i); - if (ally == NULL) - continue; - safesnprintf(atcmd_output, sizeof(atcmd_output), "- - Ally #%d (Id: %d): %s", i + 1, ally->clan_id, ally->constant); clif->messagecolor_self(fd, COLOR_DEFAULT, atcmd_output); count++; @@ -9559,14 +9556,11 @@ ACMD(claninfo) safesnprintf(atcmd_output, sizeof(atcmd_output), "- Antagonists: %d", VECTOR_LENGTH(c->antagonists)); clif->messagecolor_self(fd, COLOR_DEFAULT, atcmd_output); - + count = 0; for (i = 0; i < VECTOR_LENGTH(c->antagonists); i++) { struct clan_relationship *antagonist = &VECTOR_INDEX(c->antagonists, i); - if (antagonist == NULL) - continue; - safesnprintf(atcmd_output, sizeof(atcmd_output), "- - Antagonist #%d (Id: %d): %s", i + 1, antagonist->clan_id, antagonist->constant); clif->messagecolor_self(fd, COLOR_DEFAULT, atcmd_output); count++; @@ -9575,7 +9569,7 @@ ACMD(claninfo) if (count == 0) { clif->messagecolor_self(fd, COLOR_DEFAULT, "- - No Antagonists Found!"); } - + clif->messagecolor_self(fd, COLOR_DEFAULT, "============================"); } dbi_destroy(iter); diff --git a/src/map/clan.c b/src/map/clan.c index 6855e449d..2c12df492 100644 --- a/src/map/clan.c +++ b/src/map/clan.c @@ -523,7 +523,7 @@ int clan_inactivity_kick(int tid, int64 tick, int id, intptr_t data) if ((c = clan->search(id)) != NULL) { if (!c->kick_time || c->tid != tid || tid == INVALID_TIMER || c->tid == INVALID_TIMER) { ShowError("Timer Mismatch (Time: %d seconds) %d != %d", c->kick_time, c->tid, tid); - Assert_retr(0, 0); + Assert_report(0); return 0; } for (i = 0; i < VECTOR_LENGTH(c->members); i++) { -- cgit v1.2.3-60-g2f50