diff --git a/auth/password_authenticator.cc b/auth/password_authenticator.cc index a53ddc401d..47ae0df1dd 100644 --- a/auth/password_authenticator.cc +++ b/auth/password_authenticator.cc @@ -317,7 +317,11 @@ future password_authenticator::authenticate( }).then_wrapped([=](future<::shared_ptr> f) { try { auto res = f.get0(); - if (res->empty() || !checkpw(password, res->one().get_as(SALTED_HASH))) { + auto salted_hash = std::experimental::optional(); + if (!res->empty()) { + salted_hash = res->one().get_opt(SALTED_HASH); + } + if (!salted_hash || !checkpw(password, *salted_hash)) { throw exceptions::authentication_exception("Username and/or password are incorrect"); } return make_ready_future(username);