mirror of
https://github.com/Sonarr/Sonarr
synced 2026-05-07 04:20:50 +02:00
Fixed: Unexpected languages stored in DB will be treated as Unknown
Closes #8482
This commit is contained in:
parent
9a0e23a93f
commit
dfd5e4ba37
1 changed files with 7 additions and 0 deletions
|
|
@ -34,8 +34,15 @@ public override Language Parse(object value)
|
|||
|
||||
public class LanguageIntConverter : JsonConverter<Language>
|
||||
{
|
||||
public override bool HandleNull => true;
|
||||
|
||||
public override Language Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||
{
|
||||
if (reader.TokenType == JsonTokenType.Null)
|
||||
{
|
||||
return Language.Unknown;
|
||||
}
|
||||
|
||||
var item = reader.GetInt32();
|
||||
return (Language)item;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue