coverity#1158060 Dereference after null check

Change-Id: I6e87e36aeb3416a38c11402ebc5bfb59b123173d
coverity#1157791 Division or modulo by zero

Change-Id: I6b46a037b0d5f13681ad4936ddd56fd80c8128fb
coverity#1157789 Division or modulo by zero

Change-Id: I7c6fc34702acce21759dad00626ff4ffcd0ced95
coverity#1157758 Dead default in switch

Change-Id: I1df0e8e159daff0ad29894c8d8f1984cd70fd130
coverity#1132706 Dereference before null check

Change-Id: Ic59a2e7425ed117f1ba43ed438650bfb5eed77cb