From 9766a9ae08532c2c9978082101d0c386b0464b09 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Thu, 29 Jul 2021 23:04:59 +0200 Subject: [PATCH] Fix compilation with persistence feature --- src/app.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/app.rs b/src/app.rs index 45570cc..c165796 100644 --- a/src/app.rs +++ b/src/app.rs @@ -29,8 +29,15 @@ impl epi::App for TemplateApp { /// Called by the framework to load old app state (if any). #[cfg(feature = "persistence")] - fn load(&mut self, storage: &dyn epi::Storage) { - *self = epi::get_value(storage, epi::APP_KEY).unwrap_or_default() + fn setup( + &mut self, + _ctx: &egui::CtxRef, + _frame: &mut epi::Frame<'_>, + storage: Option<&dyn epi::Storage>, + ) { + if let Some(storage) = storage { + *self = epi::get_value(storage, epi::APP_KEY).unwrap_or_default() + } } /// Called by the frame work to save state before shutdown.