BUG: Coverity 1081129: Dereference before null check in itkIOCommonTest

Fixed a bug where the string pointer was compared to NULL, instead of
correctly comparing the first element to (i.e. testing if the string is
empty).

Also refactor some code to make each logical section clearer.

Change-Id: If7e6a540859362cc75d9ba2031271c4a48ca90c7
Merge topic 'cov_1081129'

0adacf02 BUG: Coverity 1081129: Dereference before null check in itkIOCommonTest