aboutsummaryrefslogtreecommitdiff
path: root/GradeBook_lib.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'GradeBook_lib.tcl')
-rwxr-xr-xGradeBook_lib.tcl5
1 files changed, 5 insertions, 0 deletions
diff --git a/GradeBook_lib.tcl b/GradeBook_lib.tcl
index 21b590e..000bdfe 100755
--- a/GradeBook_lib.tcl
+++ b/GradeBook_lib.tcl
@@ -2307,6 +2307,11 @@ proc data2txtPlot { data } {
foreach x $data {
# funky 1.1 are needed to convert it to floats
set cnt [expr { round((1.0*$x-$minVal)/(1.1*$diffVal)*(1.1*($barsNum-1.0))) }]
+
+ # safety check on counter value
+ set cnt [expr {min($cnt, ($barsNum-1))}]
+ set cnt [expr {max($cnt, 0)}]
+
set bar [lrange $chars $cnt $cnt]
lappend strPlot $bar
}