Skip to content

Commit

Permalink
DMU: Fixed refactoring oversight in P_ToPtr()
Browse files Browse the repository at this point in the history
The semantics of looking up a Material by manifest id differ from
those of the DMU API itself. This function must either check that
the given index is non-zero before calling Materials::toManifest()
or handle the exception.

We'll test for a non-zero index specially so that the exception is
otherwise still raised as expected.
  • Loading branch information
danij-deng committed Apr 21, 2013
1 parent 4437de3 commit 4b9b44e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion doomsday/client/src/map/p_dmu.cpp
Expand Up @@ -357,7 +357,9 @@ void *P_ToPtr(int type, int index)

case DMU_MATERIAL:
/// @note @a index is 1-based.
return &App_Materials().toManifest(index).material();
if(index > 0)
return &App_Materials().toManifest(index).material();
return 0;

default: {
/// @todo Throw exception.
Expand Down

0 comments on commit 4b9b44e

Please sign in to comment.