fp_lib_table: explicit assumption by assert

This commit makes an implicit assumption explicit by describing it with
an assert.

Fixes lp:1778426

https://bugs.launchpad.net/kicad/+bug/1778426
This commit is contained in:
Martin Aberg 2018-06-29 19:36:58 -04:00 committed by Wayne Stambaugh
parent b3db6572e8
commit 9b1f2447b6
1 changed files with 5 additions and 2 deletions

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2010-2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2012-2016 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 2012-2017 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2012-2018 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -275,7 +275,10 @@ void FP_LIB_TABLE::PrefetchLib( const wxString& aNickname )
const FP_LIB_TABLE_ROW* FP_LIB_TABLE::FindRow( const wxString& aNickname )
{
FP_LIB_TABLE_ROW* row = dynamic_cast< FP_LIB_TABLE_ROW* >( findRow( aNickname ) );
// Do not optimize this code. Is done this way specifically to fix a runtime
// error with clang 4.0.1.
LIB_TABLE_ROW* ltrow = findRow( aNickname );
FP_LIB_TABLE_ROW* row = dynamic_cast< FP_LIB_TABLE_ROW* >( ltrow );
if( !row )
{