[gnome-sudoku/vala-port] Fixed the Sudoku crash on starting Hard/Very Hard games
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-sudoku/vala-port] Fixed the Sudoku crash on starting Hard/Very Hard games
- Date: Fri, 28 Feb 2014 14:43:23 +0000 (UTC)
commit 8d9142f94c9b40b050f6beb00a72462302ca3e86
Author: Parin Porecha <parinporecha gmail com>
Date: Thu Feb 27 18:57:35 2014 +0530
Fixed the Sudoku crash on starting Hard/Very Hard games
According to the docs, when the MapIterator is out of track,
neither get_key, get_value, set_value nor unset are defined
and all will fail.
After the next call to next(), they will be defined again.
When the MapIterator is initialized, it is out of track.
Because of it, the assertion to check that failed,
and it caused the crash.
This patch advances the iter by calling next()
https://bugzilla.gnome.org/show_bug.cgi?id=633464
src/sudoku-solver.vala | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/src/sudoku-solver.vala b/src/sudoku-solver.vala
index 1ce530b..70f9ae2 100644
--- a/src/sudoku-solver.vala
+++ b/src/sudoku-solver.vala
@@ -350,6 +350,8 @@ public class SudokuSolver
// Find the square with the least possibilties
MapIterator<Coord?, ArrayList<int>> iter = poss.map_iterator ();
+
+ iter.next ();
Coord least_coord = iter.get_key ();
ArrayList<int> least_coord_possibilties = iter.get_value ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]