Fix #832: Only copy/move storage value when optional is valid (#833)

This commit is contained in:
Chiraffollo 2024-01-27 01:55:51 +01:00 committed by GitHub
parent 0f1840a70d
commit 84031659fa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -768,7 +768,10 @@ namespace etl
{
if (this != &other)
{
storage.value = other.storage.value;
if (other.valid)
{
storage.value = other.storage.value;
}
valid = other.valid;
}
@ -783,7 +786,10 @@ namespace etl
{
if (this != &other)
{
storage.value = etl::move(other.storage.value);
if (other.valid)
{
storage.value = etl::move(other.storage.value);
}
valid = other.valid;
}