fix crash in dehaze, fixes #6364

This commit is contained in:
Ingo Weyrich
2021-09-19 10:25:53 +02:00
parent 5268b94cfd
commit f47eb15d2b

View File

@@ -210,6 +210,10 @@ float estimate_ambient_light(const array2D<float> &R, const array2D<float> &G, c
}
}
if (p.size() == 0) {
return 0.f;
}
const int pos = p.size() * 0.95;
std::nth_element(p.begin(), p.begin() + pos, p.end());
darklim = p[pos];