Problem with loading .obj files (fix)

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.
Post Reply
tbyte
Posts: 2
Joined: Wed May 05, 2004 9:53 pm

Problem with loading .obj files (fix)

Post by tbyte »

Some of the .obj exporters don't end the file by ascii 0 so irrlich crashes when it tries to load that kind of file.

This is a quick fix for this condition that assures that the buffer will be zero ended:

--- CStaticMeshOBJ.cpp Sat Dec 27 13:12:00 2003
+++ CStaticMeshOBJ.cpp.new Thu May 6 00:47:16 2004
@@ -64,8 +64,9 @@
if (!filesize)
return false;

- c8* buf = new c8[filesize];
+ c8* buf = new c8[filesize + 1];
file->read((void*)buf, filesize);
+ buf[filesize] = 0;

c8* line = buf;
Post Reply