Add null check as sg_ can be NULL if SecurityGroupEntry::Activate() is
not called.

recheck no bug

Change-Id: Icd030ded7fc0e03fe7326478a0476d90619a58a3
Closes-bug: 1398885
Merge "Add null check as sg_ can be NULL if SecurityGroupEntry::Activate() is not called."