summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/libdivecomputer.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/core/libdivecomputer.c b/core/libdivecomputer.c
index 14fe42a6e..fde142e0d 100644
--- a/core/libdivecomputer.c
+++ b/core/libdivecomputer.c
@@ -115,7 +115,7 @@ static int parse_gasmixes(device_data_t *devdata, struct dive *dive, dc_parser_t
#endif
bool no_volume = true;
- for (i = 0; i < ngases || i < ntanks; i++) {
+ for (i = 0; i < MAX_CYLINDERS && (i < ngases || i < ntanks); i++) {
if (i < ngases) {
dc_gasmix_t gasmix = { 0 };
int o2, he;
@@ -124,10 +124,7 @@ static int parse_gasmixes(device_data_t *devdata, struct dive *dive, dc_parser_t
if (rc != DC_STATUS_SUCCESS && rc != DC_STATUS_UNSUPPORTED)
return rc;
- if (i >= MAX_CYLINDERS)
- continue;
-
- o2 = lrint(gasmix.oxygen * 1000);
+ o2 = lrint(gasmix.oxygen * 1000);
he = lrint(gasmix.helium * 1000);
/* Ignore bogus data - libdivecomputer does some crazy stuff */