guard against null string in stringwidth functions
hud drawlists may actually pass null to them
This commit is contained in:
1 parent
1ed616dcef
commit
2b39d137b4
1 file changed
+15
-1
+15
-1
@@ -3094,6 +3094,9 @@ INT32 V_SubStringWidth(const char *string, INT32 length, INT32 option)
|
||||
INT32 spacewidth = 4, charwidth = 0;
|
||||
ssize_t i;
|
||||
|
||||
if (!string)
|
||||
return 0;
|
||||
|
||||
if (length < 0)
|
||||
length = strlen(string);
|
||||
|
||||
@@ -3136,6 +3139,9 @@ INT32 V_SmallSubStringWidth(const char *string, INT32 length, INT32 option)
|
||||
INT32 spacewidth = 2, charwidth = 0;
|
||||
ssize_t i;
|
||||
|
||||
if (!string)
|
||||
return 0;
|
||||
|
||||
if (length < 0)
|
||||
length = strlen(string);
|
||||
|
||||
@@ -3176,9 +3182,14 @@ INT32 V_ThinSubStringWidth(const char *string, INT32 length, INT32 option)
|
||||
{
|
||||
INT32 c, w = 0;
|
||||
INT32 spacewidth = 2, charwidth = 0;
|
||||
boolean lowercase = (option & V_ALLOWLOWERCASE);
|
||||
boolean lowercase;
|
||||
ssize_t i;
|
||||
|
||||
if (!string)
|
||||
return 0;
|
||||
|
||||
lowercase = (option & V_ALLOWLOWERCASE);
|
||||
|
||||
if (length < 0)
|
||||
length = strlen(string);
|
||||
|
||||
@@ -3233,6 +3244,9 @@ INT32 V_SubStringLengthToFit(const char *string, INT32 width, INT32 option)
|
||||
INT32 spacewidth = 4, charwidth = 0;
|
||||
INT32 i;
|
||||
|
||||
if (!string)
|
||||
return 0;
|
||||
|
||||
switch (option & V_SPACINGMASK)
|
||||
{
|
||||
case V_MONOSPACE:
|
||||
|
||||
Reference in new issue
Block a user