Fix NPE in version macro if no qualifier is present.

Includes unit test.