fix: optimization: PVS-Studio warning V831
Replaced 'at()' method with 'operator[]' to improve performance. The 'at()' method performs bounds checking, which can introduce overhead. Using 'operator[]' bypasses this check and can improve performance when you are certain that the index is within bounds. Reported by: PVS-Studio Signed-off-by: Vyacheslav Ivanov <islavaivanov76@gmail.com>
This commit is contained in:
committed by
MihailRis
parent
97a0bb5776
commit
8c5e5559ec
+1
-1
@@ -253,7 +253,7 @@ speakerid_t audio::play(
|
||||
if (!sound->variants.empty()) {
|
||||
size_t index = rand() % (sound->variants.size() + 1);
|
||||
if (index < sound->variants.size()) {
|
||||
sound = sound->variants.at(index).get();
|
||||
sound = sound->variants[index].get();
|
||||
}
|
||||
}
|
||||
auto speaker_ptr = sound->newInstance(priority, channel);
|
||||
|
||||
Reference in New Issue
Block a user