Fixed a missed null check before a disposed is taking place