Redmine #4751: Fix crash in 07_packages/907.cf test case.

The package_name_convention can be unset, so we need to check for null
pointer.
(cherry picked from commit ba40441c38b1680b70ae79fc298065adeaffd894)