]> git.tdb.fi Git - libs/gltk.git/commitdiff
Report non-basic variables in Layout::LinearProgram as having zero value
authorMikko Rasa <tdb@tdb.fi>
Tue, 27 Nov 2012 11:04:39 +0000 (13:04 +0200)
committerMikko Rasa <tdb@tdb.fi>
Tue, 27 Nov 2012 14:50:31 +0000 (16:50 +0200)
source/layout.cpp

index 74b33f0bce1933de385720eed1eabe6e821956b2..2972ec8567829a9faabe9caa7d7ab09733a26914 100644 (file)
@@ -365,8 +365,10 @@ float Layout::LinearProgram::get_variable(unsigned i)
        if(i+1>=n_columns)
                throw out_of_range("LinearProgram::get_variable");
 
-       unsigned r = columns[i].basic;
-       return columns.back().values[r];
+       if(unsigned r = columns[i].basic)
+               return columns.back().values[r];
+       else
+               return 0;
 }
 
 bool Layout::LinearProgram::solve()