Commit da3e3b60 by 李进峰

pointer is null

parent ff1afd3c
...@@ -302,6 +302,7 @@ public class GameEnv implements Serializable{ ...@@ -302,6 +302,7 @@ public class GameEnv implements Serializable{
if(placeA.equals(placeB)) { if(placeA.equals(placeB)) {
return 0; return 0;
}else { }else {
try {
int x = this.mapNames.get(placeA); int x = this.mapNames.get(placeA);
int y = this.mapNames.get(placeB); int y = this.mapNames.get(placeB);
if(this.mapGraph[x][y] == 1) { if(this.mapGraph[x][y] == 1) {
...@@ -309,6 +310,9 @@ public class GameEnv implements Serializable{ ...@@ -309,6 +310,9 @@ public class GameEnv implements Serializable{
}else { }else {
return 2; return 2;
} }
}catch(Exception e) {
return -1;
}
} }
} }
// 两点之间的路径 // 使用广度优先算法单源最短路的SPFA算法的全称是:Shortest Path Faster Algorithm。 // 两点之间的路径 // 使用广度优先算法单源最短路的SPFA算法的全称是:Shortest Path Faster Algorithm。
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment