Fix PHP error "Call to a member function getText() on a non-object"

Bug: 36781
Change-Id: I918f7e6ba0f7d335ea0faad07b65db633a7c4f3b
Merge "Fix PHP error "Call to a member function getText() on a non-object""