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

Commit 12412d2c authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "AudioPolicy: Replace ALOG with nullptr check before adding values to vector" into main

parents b1fd6953 9891efe1
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -225,8 +225,7 @@ void DeviceVector::add(const DeviceVector &devices)
{
    bool added = false;
    for (const auto& device : devices) {
        ALOG_ASSERT(device != nullptr, "Null pointer found when adding DeviceVector");
        if (indexOf(device) < 0 && SortedVector::add(device) >= 0) {
        if (device && indexOf(device) < 0 && SortedVector::add(device) >= 0) {
            added = true;
        }
    }
@@ -238,7 +237,10 @@ void DeviceVector::add(const DeviceVector &devices)

ssize_t DeviceVector::add(const sp<DeviceDescriptor>& item)
{
    ALOG_ASSERT(item != nullptr, "Adding null pointer to DeviceVector");
    if (!item) {
        ALOGW("DeviceVector::%s() null device", __func__);
        return -1;
    }
    ssize_t ret = indexOf(item);

    if (ret < 0) {