[message-listener] reformat apple-specific code and eliminate coverity warning

eliminate coverity warning

    Explicit null dereferenced
Merge pull request #237 from Chilledheart/patch-7

[message-listener] reformat apple-specific code and eliminate coverity w...