summaryrefslogtreecommitdiff
path: root/app/services/projects/create_service.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/services/projects/create_service.rb')
-rw-r--r--app/services/projects/create_service.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/services/projects/create_service.rb b/app/services/projects/create_service.rb
index 9f335cceb67..9ea1b8f2f2a 100644
--- a/app/services/projects/create_service.rb
+++ b/app/services/projects/create_service.rb
@@ -65,7 +65,7 @@ module Projects
message = "Unable to save #{e.record.type}: #{e.record.errors.full_messages.join(", ")} "
fail(error: message)
rescue => e
- @project.errors.add(:base, e.message) if @project
+ @project&.errors&.add(:base, e.message)
fail(error: e.message)
end
@@ -153,7 +153,7 @@ module Projects
log_message << " Project ID: #{@project.id}" if @project&.id
Rails.logger.error(log_message)
- if @project && @project.persisted? && @project.import_state
+ if @project&.persisted? && @project.import_state
@project.import_state.mark_as_failed(message)
end