[core] Fix potential null pointer in TwoWayLayoutManager
[layouts] Fix potential null pointer in BaseLayoutManager
Merge pull request #109 from athornz/master