Add asserts to avoid null pointer derefeences
Merge pull request #2284 from wmtan/AddAssertsToMaybeAvoidSegfaults

Framework cleanup -- Add asserts to avoid null pointer dereferences