Skip to content

Commit 11fdb83

Browse files
committed
Ignore invalid strings, some models use them for some reason
1 parent e4e395b commit 11fdb83

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

io_scene_a3d/A3DObjects.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ def read2(self, stream):
3636
print(f"[A3DMaterial name: {self.name} color: {self.color} diffuse map: {self.diffuseMap}]")
3737

3838
def read3(self, stream):
39+
print(stream.tell())
3940
self.name = readLengthPrefixedString(stream)
4041
self.color = unpackStream("<3f", stream)
4142
self.diffuseMap = readLengthPrefixedString(stream)

io_scene_a3d/IOTools.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def readNullTerminatedString(stream):
3333
while char != b"\x00":
3434
string += char
3535
char = stream.read(1)
36-
return string.decode("utf8")
36+
return string.decode("utf8", errors="ignore")
3737

3838
def calculatePadding(length):
3939
# (it basically works with rounding)
@@ -47,4 +47,4 @@ def readLengthPrefixedString(stream):
4747
paddingSize = calculatePadding(length)
4848
stream.read(paddingSize)
4949

50-
return string.decode("utf8")
50+
return string.decode("utf8", errors="ignore")

0 commit comments

Comments
 (0)