mirror of
https://github.com/hyprwm/aquamarine.git
synced 2024-11-17 03:46:00 +01:00
backend: avoid out_of_range on iterating options
This commit is contained in:
parent
40f6fa5173
commit
0ffcb7fa74
1 changed files with 11 additions and 3 deletions
|
@ -80,15 +80,23 @@ bool Aquamarine::CBackend::start() {
|
|||
bool fallback = false;
|
||||
int started = 0;
|
||||
|
||||
auto optionsForType = [this] (eBackendType type) -> SBackendImplementationOptions {
|
||||
for (auto& o : implementationOptions) {
|
||||
if (o.backendType == type)
|
||||
return o;
|
||||
}
|
||||
return SBackendImplementationOptions{};
|
||||
};
|
||||
|
||||
for (size_t i = 0; i < implementations.size(); ++i) {
|
||||
const bool ok = implementations.at(i)->start();
|
||||
|
||||
if (!ok) {
|
||||
log(AQ_LOG_ERROR, std::format("Requested backend ({}) could not start, enabling fallbacks", backendTypeToName(implementationOptions.at(i).backendType)));
|
||||
log(AQ_LOG_ERROR, std::format("Requested backend ({}) could not start, enabling fallbacks", backendTypeToName(implementations.at(i)->type())));
|
||||
fallback = true;
|
||||
if (implementationOptions.at(i).backendRequestMode == AQ_BACKEND_REQUEST_MANDATORY) {
|
||||
if (optionsForType(implementations.at(i)->type()).backendRequestMode == AQ_BACKEND_REQUEST_MANDATORY) {
|
||||
log(AQ_LOG_CRITICAL,
|
||||
std::format("Requested backend ({}) could not start and it's mandatory, cannot continue!", backendTypeToName(implementationOptions.at(i).backendType)));
|
||||
std::format("Requested backend ({}) could not start and it's mandatory, cannot continue!", backendTypeToName(implementations.at(i)->type())));
|
||||
implementations.clear();
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue