diff --git a/ObjectiveGit/GTRepository.m b/ObjectiveGit/GTRepository.m index 133216cd4..b49a2940e 100644 --- a/ObjectiveGit/GTRepository.m +++ b/ObjectiveGit/GTRepository.m @@ -108,10 +108,10 @@ - (BOOL)isEqual:(GTRepository *)repo { } - (void)dealloc { - if (_git_repository != NULL) { + if (_git_repository != NULL && _git_repository.workdir != NULL) { git_repository_free(_git_repository); - _git_repository = NULL; } + _git_repository = NULL; } #pragma mark API