jbruening / ugui-mvvm

Unity3D uGUI mvvm databinding via the standard IXChanged interfaces used in wpf (INotifyPropertyChanged, INotifyCollectionChanged, etc)
Other
214 stars 41 forks source link

Harden PropertyBinding's AddHandler to ensure that property is readable before traversing #40

Closed hendryems closed 3 years ago

hendryems commented 3 years ago

This is a bug exposed as part of commit 644a5cc

In addition to Source -> Target, bindings are also checking for Target -> Source.

This can cause issues if the Target's path only exposes setters. The PropertyBinding's AddHandler implementation does not correctly handle that case (it always assumes properties are both read/write).

The fix is trivial, we simply ensure that property is readable before accessing it.