In the working part it is a method
if (tm.getLine1Number().
In the non-working code it is used as a variable (no"()")
if (tm.getLine1Number = null)
Also you want to compare not initialize so change it from
if (tm.getLine1Number = null)
to
if (tm.getLine1Number() == null)
Add the extra "="