1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-11-19 16:45:17 +00:00

Avoid throwing exceptions from destructors

Detected by clang-tidy check bugprone-exception-escape
This commit is contained in:
Carles Fernandez
2019-02-10 21:55:51 +01:00
parent 75bd492d96
commit 4b2b205e21
36 changed files with 897 additions and 373 deletions

View File

@@ -31,6 +31,7 @@
#include "labsat23_source.h"
#include <gnuradio/io_signature.h>
#include <exception>
#include <iostream>
#include <sstream>
@@ -88,9 +89,20 @@ labsat23_source::labsat23_source(const char *signal_file_basename,
labsat23_source::~labsat23_source()
{
if (binary_input_file->is_open())
try
{
binary_input_file->close();
if (binary_input_file->is_open())
{
binary_input_file->close();
}
}
catch (const std::ifstream::failure &e)
{
std::cerr << "Problem closing input file" << '\n';
}
catch (const std::exception &e)
{
std::cerr << e.what() << '\n';
}
delete binary_input_file;
}