Added null checks for getContent Height and Width for layouts