From 0d654b3574383f2a7f86af82b61c3db34f600115 Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Sun, 10 May 2020 18:43:01 -0400 Subject: [PATCH] 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. --- eeschema/sch_base_frame.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eeschema/sch_base_frame.h b/eeschema/sch_base_frame.h index 5206cc0721..ba6a9ee4c4 100644 --- a/eeschema/sch_base_frame.h +++ b/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( config() ); } + EESCHEMA_SETTINGS* eeconfig() const { return dynamic_cast( config() ); } void LoadSettings( APP_SETTINGS_BASE* aCfg ) override; void SaveSettings( APP_SETTINGS_BASE* aCfg ) override;