Skip to content
This repository has been archived by the owner on Mar 30, 2024. It is now read-only.

Bug: Use of assert prevents code from being executed when optimization is turned on #74

Closed
foobarzap opened this issue May 6, 2018 · 0 comments

Comments

@foobarzap
Copy link

In utilities.swift:

  internal mutating func skip(_ n: Int) {
        guard n < count else {
            self = Data()
            return
        }
        for _ in 0..<n {
            // -> popFirst() doesn't get executed if optimization is turned on!
            assert(popFirst() != nil)
        }
    }

Possible fix:

  internal mutating func skip(_ n: Int) {
        guard n < count else {
            self = Data()
            return
        }
        for _ in 0..<n {           
            let check = popFirst()
            assert(check != nil)
        }
    }
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

1 participant