From f75ab0bd662c73d15057d746347d09bf94a992a6 Mon Sep 17 00:00:00 2001 From: crupest Date: Wed, 16 Feb 2022 22:42:34 +0800 Subject: ... --- include/cru/platform/Check.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'include/cru/platform/Check.h') diff --git a/include/cru/platform/Check.h b/include/cru/platform/Check.h index 1750c7e8..8dc4faac 100644 --- a/include/cru/platform/Check.h +++ b/include/cru/platform/Check.h @@ -2,8 +2,8 @@ #include "Exception.h" #include "Resource.h" -#include "cru/common/String.h" #include "cru/common/Format.h" +#include "cru/common/String.h" #include #include @@ -12,7 +12,7 @@ namespace cru::platform { template TTarget* CheckPlatform(IPlatformResource* resource, const String& target_platform) { - Expects(resource); + if (resource == nullptr) return nullptr; const auto result = dynamic_cast(resource); if (result == nullptr) { throw UnsupportPlatformException(Format( @@ -26,9 +26,9 @@ TTarget* CheckPlatform(IPlatformResource* resource, template std::shared_ptr CheckPlatform(const std::shared_ptr& resource, const String& target_platform) { + if (resource == nullptr) return nullptr; static_assert(std::is_base_of_v, "TSource must be a subclass of INativeResource."); - Expects(resource); const auto result = std::dynamic_pointer_cast(resource); if (result == nullptr) { throw UnsupportPlatformException(Format( -- cgit v1.2.3