Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 05f8e379 authored by Gabriel Biren's avatar Gabriel Biren Committed by Android (Google) Code Review
Browse files

Merge "Add null check before adding iface to pointer vector" into main

parents d76d639c 36dd3c09
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -62,8 +62,10 @@ template <typename Iface>
std::vector<std::string> getNames(std::vector<std::shared_ptr<Iface>>& ifaces) {
    std::vector<std::string> names;
    for (const auto& iface : ifaces) {
        if (iface) {
            names.emplace_back(iface->getName());
        }
    }
    return names;
}

@@ -971,6 +973,10 @@ std::pair<std::shared_ptr<IWifiNanIface>, ndk::ScopedAStatus> WifiChip::createNa
    }
    std::shared_ptr<WifiNanIface> iface =
            WifiNanIface::create(ifname, is_dedicated_iface, legacy_hal_, iface_util_);
    if (!iface) {
        LOG(ERROR) << "Unable to create NAN iface";
        return {nullptr, createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)};
    }
    nan_ifaces_.push_back(iface);
    for (const auto& callback : event_cb_handler_.getCallbacks()) {
        if (!callback->onIfaceAdded(IfaceType::NAN_IFACE, ifname).isOk()) {