Avoid potential wrong memory access
If the user uses an invalid index, the [] operator won't check it and the program will access invalid memory. Using at() would throw instead.release/4.3a0
parent
32acaecdc9
commit
2b43e7f8f8
|
|
@ -355,7 +355,7 @@ class FactorGraph {
|
|||
|
||||
/** delete factor without re-arranging indexes by inserting a nullptr pointer
|
||||
*/
|
||||
void remove(size_t i) { factors_[i].reset(); }
|
||||
void remove(size_t i) { factors_.at(i).reset(); }
|
||||
|
||||
/** replace a factor by index */
|
||||
void replace(size_t index, sharedFactor factor) { at(index) = factor; }
|
||||
|
|
|
|||
Loading…
Reference in New Issue