It is currently Wed Jan 17, 2018 1:17 pm

All times are UTC - 5 hours

 Page 1 of 1 [ 2 posts ] 
Author Message
 Post subject: Bug in Scene::Assign functions
PostPosted: Fri Aug 20, 2010 1:10 pm 

Joined: Wed Dec 24, 2008 4:25 pm
Posts: 16
There are several Assign* functions in the Scene class that share the same bug. I'll use AssignTexture to illustrate.

The code begins by checking to see if the textureID is greater than the size of the vector; if so, it reports an error and returns false. But it's possible to be passed an ID of 0, which fails at the end, where 'textureID - 1' is used as an index. The way I fixed this for myself was to add a test for 0 at the beginning. This allows the program to continue running as intended. Thus, I have:

if ((textureID == 0) || (textureID > m_textures.size()))

 Post subject:
PostPosted: Sun Aug 29, 2010 6:41 am 
Site Admin

Joined: Sun Feb 11, 2007 8:59 am
Posts: 1106
Location: Ontario Canada
I believe this bug is addressed in one of the later VMK's because in the final game engine code all the assign functions have the check for == 0 at the very top, just as you suggested.

Good catch!

Display posts from previous:  Sort by  
 Page 1 of 1 [ 2 posts ] 

All times are UTC - 5 hours

Who is online

Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Jump to: