Skip to content

Commit

Permalink
Avoid force unwraps that could crash on tests - Fixes optonaut#87
Browse files Browse the repository at this point in the history
  • Loading branch information
polqf committed Jun 16, 2016
1 parent 707f4cb commit fa897a0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ActiveLabelTests/ActiveTypeTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ class ActiveTypeTests: XCTestCase {
return label.activeElements.flatMap({$0.1.flatMap({$0.element})})
}

var currentElementString: String {
let currentElement = activeElements.first!
var currentElementString: String? {
guard let currentElement = activeElements.first else { return nil }
switch currentElement {
case .Mention(let mention):
return mention
Expand All @@ -43,8 +43,8 @@ class ActiveTypeTests: XCTestCase {
}
}

var currentElementType: ActiveType {
let currentElement = activeElements.first!
var currentElementType: ActiveType? {
guard let currentElement = activeElements.first else { return nil }
switch currentElement {
case .Mention:
return .Mention
Expand Down

0 comments on commit fa897a0

Please sign in to comment.