Skip to content

Commit 442ae94

Browse files
committed
Send the latest non-null theme directly to the new action
1 parent cc7596f commit 442ae94

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

org.mixedrealitytoolkit.theming/Theming/ThemeDataSource.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,16 @@ public void SetValueWithoutNotify(Theme newValue)
5353

5454
public void AddListener(UnityAction<ChangeEvent<Theme>> action)
5555
{
56+
if (action == null) { return; }
5657
onThemeChanged.AddListener(action);
58+
if (activeTheme == null) { return; }
5759
using ChangeEvent<Theme> changeEvent = ChangeEvent<Theme>.GetPooled(null, activeTheme);
58-
SendEvent(changeEvent);
60+
action.Invoke(changeEvent);
5961
}
6062

6163
public void RemoveListener(UnityAction<ChangeEvent<Theme>> action)
6264
{
65+
if (action == null) { return; }
6366
onThemeChanged.RemoveListener(action);
6467
}
6568

0 commit comments

Comments
 (0)