Prevent NULL dereferencing in ProtocolServer

Crash due to NULL dereferencing in ProtocolServer. Added guard that
checks for NULL before dereferencing the pointer.

BUG=chromium-os:34957
TEST=I observed this crash repeatedly during suspend_stress_test. Wrote
a script that runs suspend_stress_test and runs cromo via valgrind repeatedly
and logs valgrind output when valgrind exits. Ran this script over the
weekend and observed no invalid access.

Change-Id: I260df3051b29ff871deb35f51abf85b5af6f0491
Reviewed-on: https://gerrit.chromium.org/gerrit/34901
Reviewed-by: Ben Chan <benchan@chromium.org>
Commit-Ready: Arman Uguray <armansito@chromium.org>
Tested-by: Arman Uguray <armansito@chromium.org>
1 file changed