From 22bdf37fc2cf12ae615d7f2a43b6f7edeeca1055 Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Fri, 9 Jul 2021 16:44:23 -0400 Subject: [PATCH] Fix SPICE simulator plot bug. Fixes https://gitlab.com/kicad/code/kicad/-/issues/1944 --- eeschema/sim/sim_plot_panel.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/eeschema/sim/sim_plot_panel.cpp b/eeschema/sim/sim_plot_panel.cpp index 70cc3d3371..b8a27bef69 100644 --- a/eeschema/sim/sim_plot_panel.cpp +++ b/eeschema/sim/sim_plot_panel.cpp @@ -2,6 +2,8 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2016 CERN + * Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors. + * * @author Tomasz Wlostowski * @author Maciej Suminski * @@ -522,7 +524,11 @@ bool SIM_PLOT_PANEL::AddTrace( const wxString& aName, int aPoints, else { for( int i = 0; i < aPoints; i++ ) - tmp[i] = 20 * log( tmp[i] ) / log( 10.0 ); // convert to dB + { + // log( 0 ) is not valid. + if( tmp[i] != 0.0 ) + tmp[i] = 20 * log( tmp[i] ) / log( 10.0 ); // convert to dB + } } }