Added NULL check before unsubscribing from PasswordChanged (PasswordBindBehaviour)
Description of Change
When working with the ConnectionStringBuilder I got a crash every time I closed the window. After some investigation I figured out, that the Problem is the PasswordBindBehaviour. When the window is closed the password-box is removed and the AssociatedObject property is set to null before the OnAssociatedObjectUnloaded method gets called. This results in an exception being thrown.
To prevent this I added a NULL check before the unsubscription is done. There should be no problems with memory leaks or lingering connectios even when not explicitly unsubscribing.
API Changes
None
Platforms Affected
- All
Behavioral Changes
None
Testing Procedure
PR Checklist
- [ ] I have included examples or tests
- [ ] I have updated the change log
- [ ] I am listed in the CONTRIBUTORS file
- [ ] Rebased on top of the target branch at time of PR
- [ ] Changes adhere to coding standard
@Mazzelfassel, thanks for reporting and suggesting a fix. Will try to reproduce and check your fixes.