Fix out of tree build.

common/include/svnrev.h was generated inside the build directory
instead of the source directory.
Fix segfault in non-dev build by adding extra check for NULL.