Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

server: Return nullopt when process_context is nullptr #14181

Merged

Commits on Nov 25, 2020

  1. server: Return nullopt when process_context is nullptr

    The InstanceImpl::processContext() function returns a ProcessContextOptRef
    a.k.a. absl::optional<std::reference_wrapper<ProcessContext>>.  When
    InstanceImpl::process_context_ is nullptr, the returned value an
    absl::optional with a value of std::reference_wrapper<>(nullptr),
    better known as an illegal reference to nullptr.  While everything is
    fine in the InstanceImpl, anyone who tries to use the returned
    reference will be greeted with a crash.
    
    This commit follows the lead of the initializer of InstanceImpl::api_
    and returns absl::nullopt when InstanceImpl::process_context_ is
    nullptr.
    
    Risk: Low
    Testing: bazel test //test/server:server_test
    Documentation: N/A
    Release Notes: N/A
    
    Signed-off-by: Justin Mazzola Paluska <[email protected]>
    justin-mp committed Nov 25, 2020
    Configuration menu
    Copy the full SHA
    85b51c4 View commit details
    Browse the repository at this point in the history
  2. Format Police

    Signed-off-by: Justin Mazzola Paluska <[email protected]>
    justin-mp committed Nov 25, 2020
    Configuration menu
    Copy the full SHA
    b4f6f70 View commit details
    Browse the repository at this point in the history
  3. Address review comments

    Signed-off-by: Justin Mazzola Paluska <[email protected]>
    justin-mp committed Nov 25, 2020
    Configuration menu
    Copy the full SHA
    f2eb3f7 View commit details
    Browse the repository at this point in the history