summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2017-03-20 19:17:14 -0400
committerRobert Speicher <rspeicher@gmail.com>2017-03-20 19:17:14 -0400
commit9bf9e6eb38b955791abce475dbaec1001d6c39c0 (patch)
treeded2d40410270b25fca5e0c7a5692611031390c7 /app/models
parentb075d38c9b98d4b39441bd29d2c36be4637b6f72 (diff)
downloadgitlab-ce-9bf9e6eb38b955791abce475dbaec1001d6c39c0.tar.gz
Handle Route#name being nil after an update
It was possible for the `routes.name` field to be `NULL`, causing `name_was` to be `nil` after a rename, resulting a bad first argument to `sub` when attempting to rename descendants. This change adds a condition to make sure `name_was` is present before attempting the descendant update.
Diffstat (limited to 'app/models')
-rw-r--r--app/models/route.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/route.rb b/app/models/route.rb
index 73574a6206b..41e6eb7cb73 100644
--- a/app/models/route.rb
+++ b/app/models/route.rb
@@ -21,7 +21,7 @@ class Route < ActiveRecord::Base
attributes[:path] = route.path.sub(path_was, path)
end
- if name_changed? && route.name.present?
+ if name_changed? && name_was.present? && route.name.present?
attributes[:name] = route.name.sub(name_was, name)
end