Browse Source

Remove NULL check from Object::cast_to()

After discussing this with @reduz on IRC we agreed to remove these
checks. We now consider cast_to() to be NULL safe
Hein-Pieter van Braam 8 years ago
parent
commit
f8cb9f5516
1 changed files with 0 additions and 12 deletions
  1. 0 12
      core/object.h

+ 0 - 12
core/object.h

@@ -567,12 +567,6 @@ public:
 
 
 	template <class T>
 	template <class T>
 	static T *cast_to(Object *p_object) {
 	static T *cast_to(Object *p_object) {
-#ifdef DEBUG_ENABLED
-		// TODO there are some legitimate reasons to pass NULL as p_object.
-		// we need to figure out how to deal with that in debug mode.
-		// This code will return NULL for a NULL input in release mode also.
-		ERR_FAIL_COND_V(p_object == NULL, NULL);
-#endif
 #ifndef NO_SAFE_CAST
 #ifndef NO_SAFE_CAST
 		return dynamic_cast<T *>(p_object);
 		return dynamic_cast<T *>(p_object);
 #else
 #else
@@ -587,12 +581,6 @@ public:
 
 
 	template <class T>
 	template <class T>
 	static const T *cast_to(const Object *p_object) {
 	static const T *cast_to(const Object *p_object) {
-#ifdef DEBUG_ENABLED
-		// TODO there are some legitimate reasons to pass NULL as p_object.
-		// we need to figure out how to deal with that in debug mode.
-		// This code will return NULL for a NULL input in release mode also.
-		ERR_FAIL_COND_V(p_object == NULL, NULL);
-#endif
 #ifndef NO_SAFE_CAST
 #ifndef NO_SAFE_CAST
 		return dynamic_cast<const T *>(p_object);
 		return dynamic_cast<const T *>(p_object);
 #else
 #else