Skip to content

Commit 2bd6efb

Browse files
authored
Handle case where shader platforms and shader programs counts don't match. Hacky. (#137)
1 parent a9031e9 commit 2bd6efb

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Diff for: UnityPy/export/ShaderConverter.py

+7
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ def ConvertSerializedShader(m_Shader):
3535

3636
platformNumber = len(m_Shader.platforms)
3737
for i in range(platformNumber):
38+
if i >= len(m_Shader.compressedLengths) or i >= len(m_Shader.decompressedLengths):
39+
# m_Shader.platforms shouldn't be longer than m_shader.[de]compressedLengths, but it is
40+
break
3841
compressedSize = m_Shader.compressedLengths[i]
3942
decompressedSize = m_Shader.decompressedLengths[i]
4043

@@ -145,6 +148,10 @@ def ConvertSerializedSubPrograms(m_SubPrograms, platforms, shaderPrograms):
145148
subPrograms = list(_programList)
146149
isTier = len(subPrograms) > 1
147150
for i in range(len(platforms)):
151+
if i >= len(shaderPrograms):
152+
# platforms shouldn't be longer than shaderPrograms, but it is
153+
break
154+
148155
platform = platforms[i]
149156

150157
if CheckGpuProgramUsable(platform, programKey):

0 commit comments

Comments
 (0)