``` override fun onNext(results: List<Connectio...
# random
k
Copy code
override fun onNext(results: List<ConnectionResult>) {
    val (resultsInbound, resultsOutbound) = results.partition { it.isReturn }

    val buf = buffer

    if (buf != null) {
        if (selectedOutbound in resultsOutbound) {
            if (buf.isNotEmpty()) {
                super.onNext(buf)
            }
            buffer = null
        } else {
            buf.addAll(resultsInbound)
        }
    } else if (resultsInbound.isNotEmpty()) {
        super.onNext(resultsInbound)
    }
}
here's my code now. this will never crash and as far as I can see it's doing the correct thing. so win?