From 6e7d449495fccb053f3cea8009b7c7c9b38a0a82 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Mon, 31 Jan 2022 02:33:06 +0000 Subject: Refuse to set an extension on the wrong type of extensible. --- src/extensible.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/extensible.cpp') 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(1)); if (sync && synced) Sync(container, reinterpret_cast(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(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(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); -- cgit v1.3.1-10-gc9f91