Fix NPE when the last build of a branch has been removed.