Skip to content

Commit

Permalink
Merge pull request #45 from vortigont/resources
Browse files Browse the repository at this point in the history
prevent code from crashing in UI if TS datasource is not available so…
  • Loading branch information
vortigont authored Apr 28, 2024
2 parents d3a81e7 + a5f6ec1 commit da79f03
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion espem/interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ void ui_frame_mkchart(Interface *interf){
JsonObject params = doc.to<JsonObject>(); // parameters for charts
params[P_id] = C_gsmini;
params[C_tier] = power_chart_id;
params["interval"] = espem->ds.getTS(power_chart_id)->getInterval();
auto ts = espem->ds.getTS(power_chart_id);
// check if requested TimeSeries exist
if (ts)
params["interval"] = ts->getInterval();
params[C_scnt] = embui.paramVariant(V_SMPLCNT).as<int>(); // espem->ds.getTScap(power_chart_id); // samples counter
interf->jobject(params, true);
interf->json_frame_flush(); // flush frame
Expand Down

0 comments on commit da79f03

Please sign in to comment.