Skip to content

Instantly share code, notes, and snippets.

@alexisvl
Created March 30, 2015 15:05
Show Gist options
  • Save alexisvl/fdcd6f06437c3887e7c4 to your computer and use it in GitHub Desktop.
Save alexisvl/fdcd6f06437c3887e7c4 to your computer and use it in GitHub Desktop.
diff --git a/eeschema/dialogs/dialog_choose_component.cpp b/eeschema/dialogs/dialog_choose_component.cpp
index b16a7a9..7f88dbc 100644
--- a/eeschema/dialogs/dialog_choose_component.cpp
+++ b/eeschema/dialogs/dialog_choose_component.cpp
@@ -346,6 +346,12 @@ void DIALOG_CHOOSE_COMPONENT::renderPreview( LIB_PART* aComponent, int aUnit )
NEGATE( offset.x );
NEGATE( offset.y );
+ // Avoid rendering when either dimension is zero
+ int width, height;
+ dc.GetSize( &width, &height );
+ if( !width || !height )
+ return;
+
aComponent->Draw( NULL, &dc, offset, aUnit, m_deMorganConvert, GR_COPY,
UNSPECIFIED_COLOR, DefaultTransform, true, true, false );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment