diff --git a/lib/src/view/analysis/analysis_position_choice_screen.dart b/lib/src/view/analysis/analysis_position_choice_screen.dart index 77691bc946..7fd0fc3b26 100644 --- a/lib/src/view/analysis/analysis_position_choice_screen.dart +++ b/lib/src/view/analysis/analysis_position_choice_screen.dart @@ -147,16 +147,19 @@ class _BodyState extends State<_Body> { final initialPosition = PgnGame.startingPosition(game.headers); final rule = Rule.fromPgn(game.headers['Variant']); - // require at least 1 valid move - if (game.moves.mainline().isEmpty) return null; - final move = initialPosition.parseSan(game.moves.mainline().first.san); - if (move == null) return null; + final mainlineMoves = game.moves.mainline(); + //if there is a first move, require it to be valid, otherwise require a FEN + if ((mainlineMoves.isNotEmpty && + (initialPosition.parseSan(mainlineMoves.first.san) == null)) || + (mainlineMoves.isEmpty && game.headers['FEN'] == null)) { + return null; + } return AnalysisOptions( isLocalEvaluationAllowed: true, variant: rule != null ? Variant.fromRule(rule) : Variant.standard, pgn: textInput!, - initialMoveCursor: 1, + initialMoveCursor: mainlineMoves.isEmpty ? 0 : 1, orientation: Side.white, id: standaloneAnalysisId, );