diff --git a/Ryujinx.Common/ReactiveObject.cs b/Ryujinx.Common/ReactiveObject.cs index be30e9b2c5..8495c78f56 100644 --- a/Ryujinx.Common/ReactiveObject.cs +++ b/Ryujinx.Common/ReactiveObject.cs @@ -6,7 +6,8 @@ namespace Ryujinx.Common public class ReactiveObject { private ReaderWriterLock _readerWriterLock = new ReaderWriterLock(); - private T _value; + private bool _isInitialized = false; + private T _value; public event EventHandler> Event; @@ -25,12 +26,15 @@ namespace Ryujinx.Common _readerWriterLock.AcquireWriterLock(Timeout.Infinite); T oldValue = _value; - - _value = value; + + bool oldIsInitialized = _isInitialized; + + _isInitialized = true; + _value = value; _readerWriterLock.ReleaseWriterLock(); - if (oldValue == null || !oldValue.Equals(_value)) + if (!oldIsInitialized || !oldValue.Equals(_value)) { Event?.Invoke(this, new ReactiveEventArgs(oldValue, value)); }