Browse Source

Use dynamic_cast for safety in eeconfig()

Calling config() gets you whatever APP_SETTINGS_BASE is returned
by the underlying kiface, which is currently going to be an
EESCHEMA_SETTINGS everywhere this is used, but that isn't a
guarantee.
pull/16/head
Jon Evans 6 years ago
parent
commit
0d654b3574
  1. 2
      eeschema/sch_base_frame.h

2
eeschema/sch_base_frame.h

@ -114,7 +114,7 @@ public:
SCH_SCREEN* GetScreen() const override;
void SetScreen( BASE_SCREEN* aScreen ) override;
EESCHEMA_SETTINGS* eeconfig() const { return static_cast<EESCHEMA_SETTINGS*>( config() ); }
EESCHEMA_SETTINGS* eeconfig() const { return dynamic_cast<EESCHEMA_SETTINGS*>( config() ); }
void LoadSettings( APP_SETTINGS_BASE* aCfg ) override;
void SaveSettings( APP_SETTINGS_BASE* aCfg ) override;

Loading…
Cancel
Save