From ec2bdb74377960a3852b405a89b1fc28158c2d4a Mon Sep 17 00:00:00 2001 From: Wojciech Figat Date: Wed, 18 Jan 2023 13:20:24 +0100 Subject: [PATCH] Fix crash when copying empty span of data into `DataContainer` --- Source/Engine/Core/Types/DataContainer.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Engine/Core/Types/DataContainer.h b/Source/Engine/Core/Types/DataContainer.h index 5c29a5f3c..be63dd034 100644 --- a/Source/Engine/Core/Types/DataContainer.h +++ b/Source/Engine/Core/Types/DataContainer.h @@ -231,7 +231,7 @@ public: /// Data to copy. void Copy(const DataContainer& data) { - if (data.IsValid()) + if (data.Length() != 0) Copy(data.Get(), data.Length()); else Release(); @@ -243,7 +243,7 @@ public: /// Data to copy. void Copy(const Span& data) { - if (data.IsValid()) + if (data.Length() != 0) Copy(data.Get(), data.Length()); else Release();