]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
read past end error removed
authorguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 12 Sep 2002 08:19:47 +0000 (08:19 +0000)
committerguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 12 Sep 2002 08:19:47 +0000 (08:19 +0000)
git-svn-id: https://svn.dealii.org/trunk@6401 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/include/lac/sparse_matrix_ez.h

index b296b54386f6cfe1c8bedbfe4670e7f13d946cf5..20053ebdc4dbacdf5acf970892d707c851e46186 100644 (file)
@@ -1177,10 +1177,9 @@ SparseMatrixEZ<number>::allocate (const unsigned int row,
                                   // Find position of entry
   while (i<end && data[i].column < col) ++i;
   
-  Entry* entry = &data[i];
                                   // entry found
-  if (entry->column == col)
-    return entry;
+  if (i != end && data[i].column == col)
+    return &data[i];
 
                                   // Now, we must insert the new
                                   // entry and move all successive
@@ -1195,7 +1194,6 @@ SparseMatrixEZ<number>::allocate (const unsigned int row,
        {
                                           // Insert new entries
          data.insert(data.begin()+end, increment, Entry());
-         entry = &data[i];
                                           // Update starts of
                                           // following rows
          for (unsigned int rn=row+1;rn<row_info.size();++rn)
@@ -1208,9 +1206,9 @@ SparseMatrixEZ<number>::allocate (const unsigned int row,
                                           // does not increase
                                           // performance.
          data.push_back(Entry());
-         entry = &data[i];
        }
     }
+  Entry* entry = &data[i];
                                   // Save original entry
   Entry temp = *entry;
                                   // Insert new entry here to

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.