From ebb1660c2f764e10f20edebd964af9a6fc8c4007 Mon Sep 17 00:00:00 2001 From: Dmitry-Me Date: Wed, 16 Nov 2016 17:22:45 +0300 Subject: [PATCH] Unify null pointer checks --- tinyxml2.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tinyxml2.h b/tinyxml2.h index 82422a4..12b204f 100755 --- a/tinyxml2.h +++ b/tinyxml2.h @@ -1912,19 +1912,19 @@ public: } /// Safe cast to XMLElement. This can return null. XMLElement* ToElement() { - return ( ( _node == 0 ) ? 0 : _node->ToElement() ); + return ( _node ? _node->ToElement() : 0 ); } /// Safe cast to XMLText. This can return null. XMLText* ToText() { - return ( ( _node == 0 ) ? 0 : _node->ToText() ); + return ( _node ? _node->ToText() : 0 ); } /// Safe cast to XMLUnknown. This can return null. XMLUnknown* ToUnknown() { - return ( ( _node == 0 ) ? 0 : _node->ToUnknown() ); + return ( _node ? _node->ToUnknown() : 0 ); } /// Safe cast to XMLDeclaration. This can return null. XMLDeclaration* ToDeclaration() { - return ( ( _node == 0 ) ? 0 : _node->ToDeclaration() ); + return ( _node ? _node->ToDeclaration() : 0 ); } private: @@ -1984,16 +1984,16 @@ public: return _node; } const XMLElement* ToElement() const { - return ( ( _node == 0 ) ? 0 : _node->ToElement() ); + return ( _node ? _node->ToElement() : 0 ); } const XMLText* ToText() const { - return ( ( _node == 0 ) ? 0 : _node->ToText() ); + return ( _node ? _node->ToText() : 0 ); } const XMLUnknown* ToUnknown() const { - return ( ( _node == 0 ) ? 0 : _node->ToUnknown() ); + return ( _node ? _node->ToUnknown() : 0 ); } const XMLDeclaration* ToDeclaration() const { - return ( ( _node == 0 ) ? 0 : _node->ToDeclaration() ); + return ( _node ? _node->ToDeclaration() : 0 ); } private: