From 64b3a20adc3fe7894a5dbcf1e1d2d465e6617cf3 Mon Sep 17 00:00:00 2001 From: Abdoulbari ZAKIR Date: Tue, 10 Oct 2023 10:10:05 +0200 Subject: [PATCH] add checks --- .github/workflows/ubuntu-release.yml | 1 - .github/workflows/windows-vcpkg.yml | 1 - src/cpp/multisolver_interface/SolverCbc.cpp | 8 +++++--- src/cpp/multisolver_interface/SolverClp.cpp | 6 ++++-- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ubuntu-release.yml b/.github/workflows/ubuntu-release.yml index 88eee6c8a0..e6e7dfc258 100644 --- a/.github/workflows/ubuntu-release.yml +++ b/.github/workflows/ubuntu-release.yml @@ -6,7 +6,6 @@ on: - main - develop - ci/* - - fix/Issue-688 workflow_dispatch: workflow_run: workflows: [ "Publish Release" ] diff --git a/.github/workflows/windows-vcpkg.yml b/.github/workflows/windows-vcpkg.yml index 0e6a6fea12..a7e240815b 100644 --- a/.github/workflows/windows-vcpkg.yml +++ b/.github/workflows/windows-vcpkg.yml @@ -6,7 +6,6 @@ on: - main - develop - ci/* - - fix/Issue-688 workflow_dispatch: workflow_run: workflows: [ "Publish Release" ] diff --git a/src/cpp/multisolver_interface/SolverCbc.cpp b/src/cpp/multisolver_interface/SolverCbc.cpp index f2836b1771..514642ed8a 100644 --- a/src/cpp/multisolver_interface/SolverCbc.cpp +++ b/src/cpp/multisolver_interface/SolverCbc.cpp @@ -34,9 +34,11 @@ SolverCbc::~SolverCbc() { } void SolverCbc::set_fp(FILE *fp) { - setvbuf(fp, nullptr, _IONBF, 0); - _clp_inner_solver.messageHandler()->setFilePointer(fp); - _cbc.messageHandler()->setFilePointer(fp); + if (fp) { + setvbuf(fp, nullptr, _IONBF, 0); + _clp_inner_solver.messageHandler()->setFilePointer(fp); + _cbc.messageHandler()->setFilePointer(fp); + } } int SolverCbc::get_number_of_instances() { return _NumberOfProblems; } diff --git a/src/cpp/multisolver_interface/SolverClp.cpp b/src/cpp/multisolver_interface/SolverClp.cpp index e1206a66d9..97e1c9fdce 100644 --- a/src/cpp/multisolver_interface/SolverClp.cpp +++ b/src/cpp/multisolver_interface/SolverClp.cpp @@ -34,8 +34,10 @@ SolverClp::~SolverClp() { } void SolverClp::set_fp(FILE *fp) { - setvbuf(_fp, nullptr, _IONBF, 0); - _clp.messageHandler()->setFilePointer(_fp); + if (fp) { + setvbuf(_fp, nullptr, _IONBF, 0); + _clp.messageHandler()->setFilePointer(_fp); + } } int SolverClp::get_number_of_instances() { return _NumberOfProblems; }