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

Commit 3e9eeb3b authored by Andreas Huber's avatar Andreas Huber Committed by Android (Google) Code Review
Browse files

Merge "Fail to parse duration instead of asserting, if the server response...

Merge "Fail to parse duration instead of asserting, if the server response cannot be parsed." into honeycomb
parents 7f7d52ac 934ca8cb
Loading
Loading
Loading
Loading
+7 −5
Original line number Original line Diff line number Diff line
@@ -265,15 +265,17 @@ bool ASessionDescription::getDurationUs(int64_t *durationUs) const {
    const char *s = value.c_str() + 4;
    const char *s = value.c_str() + 4;
    char *end;
    char *end;
    double from = strtod(s, &end);
    double from = strtod(s, &end);
    CHECK_GT(end, s);

    CHECK_EQ(*end, '-');
    if (end == s || *end != '-') {
        return false;
    }


    s = end + 1;
    s = end + 1;
    double to = strtod(s, &end);
    double to = strtod(s, &end);
    CHECK_GT(end, s);
    CHECK_EQ(*end, '\0');


    CHECK_GE(to, from);
    if (end == s || *end != '\0' || to < from) {
        return false;
    }


    *durationUs = (int64_t)((to - from) * 1E6);
    *durationUs = (int64_t)((to - from) * 1E6);