From: Samual Date: Mon, 24 Oct 2011 18:40:54 +0000 (-0400) Subject: Add checks to getWrappedLine to prevent parsing through messages with no size (they... X-Git-Tag: xonotic-v0.6.0~35^2~78^2~7^2~9 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=cae39371bbf140892eb2696bb7febf03708da0f1;p=xonotic%2Fxonotic-data.pk3dir.git Add checks to getWrappedLine to prevent parsing through messages with no size (they wouldn't be displayed ANYWAY, waste of processing power :P) --- diff --git a/qcsrc/common/util.qc b/qcsrc/common/util.qc index d97ec0918..5ffef8f09 100644 --- a/qcsrc/common/util.qc +++ b/qcsrc/common/util.qc @@ -1322,6 +1322,12 @@ string getWrappedLine(float w, vector theFontSize, textLengthUpToWidth_widthFunc string s; s = getWrappedLine_remaining; + + if(w <= 0) + { + getWrappedLine_remaining = string_null; + return s; // the line has no size ANYWAY, nothing would be displayed. + } cantake = textLengthUpToWidth(s, w, theFontSize, tw); if(cantake > 0 && cantake < strlen(s)) @@ -1362,6 +1368,12 @@ string getWrappedLineLen(float w, textLengthUpToLength_lenFunction_t tw) string s; s = getWrappedLine_remaining; + + if(w <= 0) + { + getWrappedLine_remaining = string_null; + return s; // the line has no size ANYWAY, nothing would be displayed. + } cantake = textLengthUpToLength(s, w, tw); if(cantake > 0 && cantake < strlen(s))