From cae39371bbf140892eb2696bb7febf03708da0f1 Mon Sep 17 00:00:00 2001 From: Samual Date: Mon, 24 Oct 2011 14:40:54 -0400 Subject: [PATCH] Add checks to getWrappedLine to prevent parsing through messages with no size (they wouldn't be displayed ANYWAY, waste of processing power :P) --- qcsrc/common/util.qc | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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)) -- 2.39.2