Fix potential crash when text is nil