Avoid NPE if buffer contains a null

Test: unit tests
Bug: None
Change-Id: Ibee4fdeadeb35547d6586015816afd7df53a7918
1 file changed