Raz maze only passing 1 test case what am i missing?

public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m = sc.nextInt();
char[][] g = new char[n][m];
for (int i = 0; i < n; i++) {
String s = sc.next();
for (int j = 0; j < m; j++) {
g[i][j] = s.charAt(j);
}
}
int[][] v = new int[n][m];
solve(g, 0, 0, v);
}

public static void solve(char[][] g, int row, int col, int[][] visited) {

// if (g[g.length - 1][g[0].length - 1] == ‘X’) {
// System.out.println(“NO PATH FOUND”);
// System.exit(0);
//
// }
if (row == g.length && col == g[0].length) {
System.out.println(“NO PATH FOUND”);
System.exit(0);
}
if (row == g.length - 1 && col == g[0].length - 1) {
visited[row][col] = 1;
for (int i = 0; i < visited.length; i++) {
for (int j = 0; j < visited[0].length; j++) {
System.out.print(visited[i][j] + " ");
}
System.out.println();
}
System.exit(0);
}
if (col == g[0].length || row == g.length || visited[row][col] == 1 || g[row][col] == ‘X’) {
return;
}
visited[row][col] = 1;
solve(g, row, col + 1, visited);
solve(g, row + 1, col, visited);
visited[row][col] = 0;
// return;
}

try for this input
5 7
OXOOOOX
OXOXOXX
OXOXOOX
OOOXOXX
XXOXOOO
correct answer :
1 0 1 1 1 0 0
1 0 1 0 1 0 0
1 0 1 0 1 0 0
1 1 1 0 1 0 0
0 0 0 0 1 1 1
your code gives : NO PATH FOUND