From b7811825ef7db7d9ec50edfb918d549dac3172c2 Mon Sep 17 00:00:00 2001 From: Will Date: Sun, 11 Oct 2015 21:21:41 -0600 Subject: [PATCH] Fix a small bug in parsing shader names from Source engine. --- LibBSP/src/Structs/BSP/Lumps/Textures.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/LibBSP/src/Structs/BSP/Lumps/Textures.cs b/LibBSP/src/Structs/BSP/Lumps/Textures.cs index fd62e79..aa3f819 100644 --- a/LibBSP/src/Structs/BSP/Lumps/Textures.cs +++ b/LibBSP/src/Structs/BSP/Lumps/Textures.cs @@ -66,9 +66,10 @@ namespace LibBSP { for (int i = 0; i < data.Length; ++i) { if (data[i] == (byte)0x00) { // They are null-terminated strings, of non-constant length (not padded) - bytes = new byte[i - offset - 1]; - Array.Copy(data, offset, bytes, 0, i - offset - 1); + bytes = new byte[i - offset]; + Array.Copy(data, offset, bytes, 0, i - offset); Add(new Texture(bytes, type)); + offset = i + 1; } } return;