Efinix: Check for presence of mode header value before checking it

This commit is contained in:
Till Harbaum 2026-04-27 15:06:21 +02:00
parent 7ec3e14a89
commit 77784f0112
1 changed files with 7 additions and 4 deletions

View File

@ -218,10 +218,13 @@ void Efinix::program(unsigned int offset, bool unprotect_flash)
throw std::runtime_error("device mismatch: " + device + " != " + target); throw std::runtime_error("device mismatch: " + device + " != " + target);
} }
} }
std::string mode = bit->getHeaderVal("mode"); std::map<std::string, std::string> hdr = bit->getHeader();
if (mode.find("passive") != std::string::npos) { if(hdr.find("mode") != hdr.end()) {
delete bit; std::string mode = bit->getHeaderVal("mode");
throw std::runtime_error("passive mode not supported for flash"); if (mode.find("passive") != std::string::npos) {
delete bit;
throw std::runtime_error("passive mode not supported for flash");
}
} }
} catch (std::runtime_error& e) { } catch (std::runtime_error& e) {
throw; throw;