PackageManagerService: Fix a null pointer exception in addForInitLI

The original code can potentially access a null pointer in
"pkgSetting" variable while preparing for an exception to throw.
This CL adds a check before using its value.

Bug: 189106370
Test: Build successful. No regression in app installation.
Change-Id: I6390a5d20409ac8641e91bffa6a85fefc50c68a6
(cherry picked from commit efda5d48a3343830a58b49ce363dc108be916b47)
(cherry picked from commit ced771333beb7e35c89715a20081f261b8521819)
1 file changed