Skip to content

Commit

Permalink
fix: ensure only non-None JSON objects are appended to the chart data
Browse files Browse the repository at this point in the history
  • Loading branch information
wu-vincent committed Sep 9, 2024
1 parent 759f430 commit 3b36407
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/endstone_bstats/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,9 @@ def _submit_data(self):
chart_data = []
for chart in self._custom_charts:
try:
chart_data.append(chart._get_request_json_object())
chart_json = chart._get_request_json_object()
if chart_json is not None:
chart_data.append(chart_json)
except Exception as e:
if self._log_errors:
self.log_error(
Expand Down
2 changes: 1 addition & 1 deletion src/endstone_bstats/_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def __init__(self, plugin: Plugin, service_id: int) -> None:
)

self.add_custom_chart(
SimplePie("endstone_version", lambda: self._server.version)
SimplePie("endstone_version", lambda: self._plugin.server.version)
)
self.add_custom_chart(DrilldownPie("python_version", self._get_python_version))

Expand Down

0 comments on commit 3b36407

Please sign in to comment.