skip parsed line if invalid mode

This commit is contained in:
MaxOhn
2023-02-09 07:26:55 +01:00
parent 9067759dc2
commit a96a6b8ee0
2 changed files with 1 additions and 5 deletions
-4
View File
@@ -15,8 +15,6 @@ pub enum ParseError {
InvalidCurvePoints,
/// Expected a decimal number, got something else.
InvalidDecimalNumber,
/// Failed to parse game mode.
InvalidMode,
/// Failed to recognized specified type for hitobjects.
UnknownHitObjectKind,
}
@@ -30,7 +28,6 @@ impl fmt::Display for ParseError {
}
Self::InvalidCurvePoints => f.write_str("invalid curve point"),
Self::InvalidDecimalNumber => f.write_str("invalid float number"),
Self::InvalidMode => f.write_str("invalid mode"),
Self::UnknownHitObjectKind => f.write_str("unsupported hitobject kind"),
}
}
@@ -43,7 +40,6 @@ impl StdError for ParseError {
Self::IncorrectFileHeader => None,
Self::InvalidCurvePoints => None,
Self::InvalidDecimalNumber => None,
Self::InvalidMode => None,
Self::UnknownHitObjectKind => None,
}
}
+1 -1
View File
@@ -126,7 +126,7 @@ macro_rules! parse_general_body {
"1" => Some(GameMode::Taiko),
"2" => Some(GameMode::Catch),
"3" => Some(GameMode::Mania),
_ => return Err(ParseError::InvalidMode),
_ => continue,
};
}