mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-23 04:12:12 +00:00
Fixed a crash when sprite/texture names longer than 8 bytes are referenced
This commit is contained in:
parent
3fcc618180
commit
bf4b898aba
1 changed files with 7 additions and 2 deletions
|
@ -140,11 +140,16 @@ namespace CodeImp.DoomBuilder.IO
|
|||
// This makes the fixed name from normal name
|
||||
public static byte[] MakeFixedName(string name, Encoding encoding)
|
||||
{
|
||||
// Make uppercase name and count bytes
|
||||
string uppername = name.Trim().ToUpper();
|
||||
int bytes = encoding.GetByteCount(uppername);
|
||||
if(bytes < 8) bytes = 8;
|
||||
|
||||
// Make 8 bytes, all zeros
|
||||
byte[] fixedname = new byte[8];
|
||||
byte[] fixedname = new byte[bytes];
|
||||
|
||||
// Write the name in bytes
|
||||
encoding.GetBytes(name.Trim().ToUpper(), 0, name.Length, fixedname, 0);
|
||||
encoding.GetBytes(uppername, 0, name.Length, fixedname, 0);
|
||||
|
||||
// Return result
|
||||
return fixedname;
|
||||
|
|
Loading…
Reference in a new issue