Merge "Adding null check to prevent NPE" into tm-dev