From 849e5751e06d4d00f323205d5f02ee01f9f59a61 Mon Sep 17 00:00:00 2001 From: Gwenhael Goavec-Merou Date: Sun, 16 Feb 2020 16:55:37 +0100 Subject: [PATCH] main: catch exception, to finish cleanly --- src/main.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index b7f487c..f24680f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -170,8 +170,15 @@ int main(int argc, char **argv) return EXIT_FAILURE; } - if (!args.bit_file.empty()) - fpga->program(args.offset); + if (!args.bit_file.empty()) { + try { + fpga->program(args.offset); + } catch (std::exception &e) { + delete(fpga); + delete(jtag); + return EXIT_FAILURE; + } + } if (args.reset) fpga->reset();