From 2f8a324bfc8e5d523db448749bb0fe030dbe4a63 Mon Sep 17 00:00:00 2001 From: Magnus Persson Date: Sun, 13 Mar 2022 10:37:01 +0100 Subject: [PATCH] Fixed issue with converstion when SG was 0 --- src/helper.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/helper.cpp b/src/helper.cpp index d283a15..5f00eb6 100644 --- a/src/helper.cpp +++ b/src/helper.cpp @@ -50,7 +50,11 @@ void tcp_cleanup() { // // Convert sg to plato // -double convertToPlato(double sg) { return 259 - (259 / sg); } +double convertToPlato(double sg) { + if (sg) + return 259 - (259 / sg); + return 0; +} // // Convert plato to sg