Avoid exception in ApiHardMessages

Bug: 46227
Change-Id: If71bfd3af65673e325dfc912ff416e59d936e407
Merge "Avoid exception in ApiHardMessages"