aboutsummaryrefslogtreecommitdiff
path: root/src/extensible.cpp
diff options
context:
space:
mode:
authorGravatar Sadie Powell2022-01-31 02:33:06 +0000
committerGravatar Sadie Powell2022-01-31 12:01:39 +0000
commit6e7d449495fccb053f3cea8009b7c7c9b38a0a82 (patch)
tree3cb46cfe75122affd9aa7d41174d2341dff8f0e5 /src/extensible.cpp
parentMake extension names case insensitive. (diff)
Refuse to set an extension on the wrong type of extensible.
Diffstat (limited to 'src/extensible.cpp')
-rw-r--r--src/extensible.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/extensible.cpp b/src/extensible.cpp
index 32106e030..56760403f 100644
--- a/src/extensible.cpp
+++ b/src/extensible.cpp
@@ -232,6 +232,9 @@ bool BoolExtItem::Get(const Extensible* container) const
void BoolExtItem::Set(Extensible* container, bool sync)
{
+ if (container->extype != this->extype)
+ return;
+
SetRaw(container, reinterpret_cast<void*>(1));
if (sync && synced)
Sync(container, reinterpret_cast<void*>(1));
@@ -239,6 +242,9 @@ void BoolExtItem::Set(Extensible* container, bool sync)
void BoolExtItem::Unset(Extensible* container, bool sync)
{
+ if (container->extype != this->extype)
+ return;
+
UnsetRaw(container);
if (sync && synced)
Sync(container, reinterpret_cast<void*>(0));
@@ -273,6 +279,9 @@ intptr_t IntExtItem::Get(const Extensible* container) const
void IntExtItem::Set(Extensible* container, intptr_t value, bool sync)
{
+ if (container->extype != this->extype)
+ return;
+
if (value)
SetRaw(container, reinterpret_cast<void*>(value));
else
@@ -294,6 +303,9 @@ std::string IntExtItem::ToNetwork(const Extensible* container, void* item) const
void IntExtItem::Unset(Extensible* container, bool sync)
{
+ if (container->extype != this->extype)
+ return;
+
UnsetRaw(container);
if (sync && synced)
Sync(container, nullptr);