Flag an error if we accidentally introduce a second script object by accident.
This commit is contained in:
parent
abb2690367
commit
7c95eff048
|
@ -657,6 +657,11 @@ impl<'gc> XMLNode<'gc> {
|
||||||
gc_context: MutationContext<'gc, '_>,
|
gc_context: MutationContext<'gc, '_>,
|
||||||
new_object: Object<'gc>,
|
new_object: Object<'gc>,
|
||||||
) {
|
) {
|
||||||
|
if self.get_script_object().is_some() {
|
||||||
|
log::warn!("An attempt was made to change the already-established link between script object and XML node. This has been denied and is likely a bug.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
match &mut *self.0.write(gc_context) {
|
match &mut *self.0.write(gc_context) {
|
||||||
XMLNodeData::Element { script_object, .. } => *script_object = Some(new_object),
|
XMLNodeData::Element { script_object, .. } => *script_object = Some(new_object),
|
||||||
XMLNodeData::Text { script_object, .. } => *script_object = Some(new_object),
|
XMLNodeData::Text { script_object, .. } => *script_object = Some(new_object),
|
||||||
|
|
Loading…
Reference in New Issue