Added some null checking when looking for liberties around edges.