Browse Source

Fix plKeyImp warning about comparison of this and nullptr.

Darryl Pogue 10 years ago
parent
commit
608afb4270
  1. 6
      Sources/Plasma/NucleusLib/pnKeyedObject/plKeyImp.cpp
  2. 3
      Sources/Plasma/NucleusLib/pnKeyedObject/plKeyImp.h

6
Sources/Plasma/NucleusLib/pnKeyedObject/plKeyImp.cpp

@ -74,6 +74,10 @@ bool IsTrackedKey(const plKeyImp* key)
} }
#endif #endif
hsKeyedObject* plKeyImp::SafeGetObject(const plKeyImp* key) {
return key ? key->fObjectPtr : nullptr;
}
plKeyImp::plKeyImp() : plKeyImp::plKeyImp() :
fObjectPtr(nil), fObjectPtr(nil),
fStartPos(-1), fStartPos(-1),
@ -156,7 +160,7 @@ hsKeyedObject* plKeyImp::GetObjectPtr()
hsKeyedObject* plKeyImp::ObjectIsLoaded() const hsKeyedObject* plKeyImp::ObjectIsLoaded() const
{ {
return this ? fObjectPtr : nil; return plKeyImp::SafeGetObject(this);
} }
// Copy the contents of p for cloning process // Copy the contents of p for cloning process

3
Sources/Plasma/NucleusLib/pnKeyedObject/plKeyImp.h

@ -53,6 +53,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
//------------------------------------ //------------------------------------
class plKeyImp : public plKeyData class plKeyImp : public plKeyData
{ {
private:
static hsKeyedObject* SafeGetObject(const plKeyImp* key);
public: public:
plKeyImp(); plKeyImp();
plKeyImp(plUoid, uint32_t pos,uint32_t len); plKeyImp(plUoid, uint32_t pos,uint32_t len);

Loading…
Cancel
Save