[python] modpyplot: show() does nothing when the store is empty

This commit is contained in:
Émilie Feral
2020-03-30 16:41:25 +02:00
parent ce33faad11
commit b3b6565410
3 changed files with 8 additions and 0 deletions

View File

@@ -342,6 +342,9 @@ mp_obj_t modpyplot_text(mp_obj_t x, mp_obj_t y, mp_obj_t s) {
}
mp_obj_t modpyplot_show() {
if (sPlotStore->isEmpty()) {
return mp_const_none;
}
MicroPython::ExecutionEnvironment * env = MicroPython::ExecutionEnvironment::currentExecutionEnvironment();
env->displayViewController(sPlotController);
return mp_const_none;