Fix SEGV on no branch repository