The test condition should be || (srcLen == 0)

However, the else branch should work as-is for both these cases, so it might be worth not special casing it.