Fix the build with -Werror=maybe-uninitialized

gcc can't really know that the condition won't change between
the first if and the second, so help it out by initializing
the variable up top.