fix: use TryGetString to avoid crashing, fixes #10306 (#10308)

This commit is contained in:
Claus Vium 2023-10-01 05:10:42 +02:00 committed by GitHub
parent 1b4394199a
commit 7f8d9ae7c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -73,8 +73,7 @@ namespace Jellyfin.Server.Migrations.Routines
var queryResult = connection.Query("SELECT DISTINCT OfficialRating FROM TypedBaseItems");
foreach (var entry in queryResult)
{
var ratingString = entry.GetString(0);
if (string.IsNullOrEmpty(ratingString))
if (!entry.TryGetString(0, out var ratingString) || string.IsNullOrEmpty(ratingString))
{
connection.Execute("UPDATE TypedBaseItems SET InheritedParentalRatingValue = NULL WHERE OfficialRating IS NULL OR OfficialRating='';");
}