Bug 312397 - fixed few possible NPE's and warnings

The changes from commit 7e4d78772a616693a55ef16be754fe0780259e81 caused
11 new test failures in I20180728-0805. This commit fixes those NPE's
plus additionally other potential NPE's and some warnings in code.

Change-Id: I00645e044de583fa5fad0043936dc8dcef199c46
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
2 files changed