From c0da83c5de66e3096bf80a50b6ceeeb54decf4ea Mon Sep 17 00:00:00 2001 From: Luka Murn Date: Fri, 20 Apr 2018 11:45:58 +0200 Subject: [PATCH] Add some additional nil guards --- app/services/repository_table_state_column_update_service.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/services/repository_table_state_column_update_service.rb b/app/services/repository_table_state_column_update_service.rb index f66b2a4b6..b80c5a74c 100644 --- a/app/services/repository_table_state_column_update_service.rb +++ b/app/services/repository_table_state_column_update_service.rb @@ -5,6 +5,8 @@ class RepositoryTableStateColumnUpdateService # record, has EVERYTHING (booleans, symbols, keys, ...) saved as Strings. def update_states_with_new_column(repository) + raise ArgumentError, 'repository is empty' if repository.blank? + RepositoryTableState.where( repository: repository ).find_each do |table_state| @@ -24,6 +26,7 @@ class RepositoryTableStateColumnUpdateService end def update_states_with_removed_column(repository, old_column_index) + raise ArgumentError, 'repository is empty' if repository.blank? raise ArgumentError, 'old_column_index is empty' if old_column_index.blank? RepositoryTableState.where(