Merge "add null pointer check for msg buffer"