summaryrefslogtreecommitdiff
path: root/src/render/OpenGL.cpp
diff options
context:
space:
mode:
authorTom Englund <tomenglund26@gmail.com>2025-02-06 12:18:04 +0100
committerGitHub <noreply@github.com>2025-02-06 11:18:04 +0000
commitf1e32cd122ad64ba7119ee7fe65f7c1074a65b91 (patch)
treefa6f884bcdd1c876c2fb15ef496ee4bc16d936f0 /src/render/OpenGL.cpp
parent868b2b544abb61764089b0e4e9b0fd153a9db26f (diff)
core: avoid .at() and use [] operator (#9347)
avoid .at() where it makes sense and use [] operator in loops.
Diffstat (limited to 'src/render/OpenGL.cpp')
-rw-r--r--src/render/OpenGL.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp
index 75a5eadb..3b641c36 100644
--- a/src/render/OpenGL.cpp
+++ b/src/render/OpenGL.cpp
@@ -402,14 +402,14 @@ std::optional<std::vector<uint64_t>> CHyprOpenGLImpl::getModsForFormat(EGLint fo
result.reserve(mods.size());
bool linearIsExternal = false;
- for (size_t i = 0; i < mods.size(); ++i) {
- if (external.at(i)) {
- if (mods.at(i) == DRM_FORMAT_MOD_LINEAR)
+ for (size_t i = 0; i < std::min(mods.size(), external.size()); ++i) {
+ if (external[i]) {
+ if (mods[i] == DRM_FORMAT_MOD_LINEAR)
linearIsExternal = true;
continue;
}
- result.push_back(mods.at(i));
+ result.push_back(mods[i]);
}
// if the driver doesn't mark linear as external, add it. It's allowed unless the driver says otherwise. (e.g. nvidia)