Skip to content

Commit

Permalink
Fixed a bug that might invoke undefined behavior
Browse files Browse the repository at this point in the history
Calling front() on an empty container would invoke undefined behavior
  • Loading branch information
JasonGitHub committed Dec 22, 2013
1 parent 4e81197 commit 3f189a3
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions C++/chapSearching.tex
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ \subsubsection{代码}
class Solution {
public:
bool searchMatrix(const vector<vector<int>>& matrix, int target) {
if (matrix.empty()) return false;
const size_t m = matrix.size();
const size_t n = matrix.front().size();

Expand Down

0 comments on commit 3f189a3

Please sign in to comment.