Commit 24b0e1eb4504a49f2b0ed25de3acb1f82b4c6980
1 parent
e06370f2
Exists in
master
and in
23 other branches
Fixed nil problem when State wasn't found
Showing
1 changed file
with
4 additions
and
2 deletions
Show diff stats
lib/set_profile_region_from_city_state.rb
| @@ -25,8 +25,10 @@ module SetProfileRegionFromCityState | @@ -25,8 +25,10 @@ module SetProfileRegionFromCityState | ||
| 25 | def region_from_city_and_state | 25 | def region_from_city_and_state |
| 26 | if @change_region | 26 | if @change_region |
| 27 | s = State.find_by_name self.state | 27 | s = State.find_by_name self.state |
| 28 | - c = s.children.find_by_name self.city | ||
| 29 | - self.region = c | 28 | + if s |
| 29 | + c = s.children.find_by_name self.city | ||
| 30 | + self.region = c | ||
| 31 | + end | ||
| 30 | end | 32 | end |
| 31 | end | 33 | end |
| 32 | 34 |