Fix use-after-move in RTCErrorOr

Fix a use-after-move issue in RTCErrorOr, as found by clang-tidy:

  api/rtc_error.h:247:
  'error' used after it was moved

Bug: chromium:1122844
Change-Id: I9e826023618067ba37c2567b5e194c46db1dbd23
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/241200
Auto-Submit: Maksim Ivanov <emaxx@chromium.org>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35535}
This commit is contained in:
Maksim Ivanov
2021-12-14 02:37:22 +01:00
committed by WebRTC LUCI CQ
parent 5279e5278b
commit e252a12070

View File

@ -244,7 +244,7 @@ class RTCErrorOr {
// //
// REQUIRES: !error.ok(). This requirement is DCHECKed. // REQUIRES: !error.ok(). This requirement is DCHECKed.
RTCErrorOr(RTCError&& error) : error_(std::move(error)) { // NOLINT RTCErrorOr(RTCError&& error) : error_(std::move(error)) { // NOLINT
RTC_DCHECK(!error.ok()); RTC_DCHECK(!error_.ok());
} }
// Constructs a new RTCErrorOr with the given value. After calling this // Constructs a new RTCErrorOr with the given value. After calling this