]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add checks to getWrappedLine to prevent parsing through messages with no size (they...
authorSamual <samual@xonotic.org>
Mon, 24 Oct 2011 18:40:54 +0000 (14:40 -0400)
committerSamual <samual@xonotic.org>
Mon, 24 Oct 2011 18:40:54 +0000 (14:40 -0400)
qcsrc/common/util.qc

index d97ec0918be53a64e3d55e00e296b6f5c0b31032..5ffef8f092052aeb4361799d5d63ed0d34663e3c 100644 (file)
@@ -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))