From e48f58aa24f9eb1dd03a88774794757e90cbc526 Mon Sep 17 00:00:00 2001 From: Andrew Zonenberg Date: Sun, 27 Jul 2014 15:00:39 -0400 Subject: [PATCH] Fixed divide-by-zero in D_PAD::ViewGetLOD() --- pcbnew/class_pad.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pcbnew/class_pad.cpp b/pcbnew/class_pad.cpp index bd20fd83af..8349d79577 100644 --- a/pcbnew/class_pad.cpp +++ b/pcbnew/class_pad.cpp @@ -965,6 +965,11 @@ unsigned int D_PAD::ViewGetLOD( int aLayer ) const // Netnames will be shown only if zoom is appropriate if( IsNetnameLayer( aLayer ) ) { + // Pad sizes can be zero briefly when someone is typing a number like "0.5" in the pad properties dialog. + // Fail gracefully if this happens. + if( (m_Size.x == 0) && (m_Size.y == 0) ) + return UINT_MAX; + return ( 100000000 / std::max( m_Size.x, m_Size.y ) ); }