소스 검색

ensure that the value asertion does not panic

If there is no routing key available then the function will
return nil, nil and release the waitgroup. The waiters will
then type assert inflight.value which is a nil interface
value which then panics. In this case we should just return
nil as the originating function did.
Chris Bannister 10 년 전
부모
커밋
373c94a50a
1개의 변경된 파일3개의 추가작업 그리고 1개의 파일을 삭제
  1. 3 1
      session.go

+ 3 - 1
session.go

@@ -223,7 +223,9 @@ func (s *Session) routingKeyInfo(stmt string) (*routingKeyInfo, error) {
 			return nil, inflight.err
 		}
 
-		return inflight.value.(*routingKeyInfo), nil
+		key, _ := inflight.value.(*routingKeyInfo)
+
+		return key, nil
 	}
 
 	// create a new inflight entry while the data is created