Fix NPE on sending multipart texts.

Watch for deliveryIntents, parts, and sentIntents being null.
Also do some code style cleanups.

This is based on http://review.cyanogenmod.org/#/c/46009/

Change-Id: I4abe2a2bd3e45bafde32de3a0c81576d742e4cee