fix: ncm return exception when roman is null

This commit is contained in:
Zhe Fang
2025-11-24 08:42:57 -05:00
parent b1126026c2
commit ad473bbd1d
3 changed files with 8 additions and 8 deletions

View File

@@ -46,7 +46,7 @@ namespace BetterLyrics.WinUI3.Helper
return new OpacityEffect
{
Source = backgroundFontEffect,
Opacity = (float)(lyricsLine.OpacityTransition.Value * lyricsLayerOpacity),
Opacity = (float)Math.Clamp(lyricsLine.OpacityTransition.Value * lyricsLayerOpacity, 0, 1),
};
}
else
@@ -60,7 +60,7 @@ namespace BetterLyrics.WinUI3.Helper
BorderMode = EffectBorderMode.Soft,
Optimization = EffectOptimization.Speed,
},
Opacity = (float)Math.Max(lyricsLine.OpacityTransition.Value * lyricsLayerOpacity, 0),
Opacity = (float)Math.Clamp(lyricsLine.OpacityTransition.Value * lyricsLayerOpacity, 0, 1),
};
}
}
@@ -119,7 +119,7 @@ namespace BetterLyrics.WinUI3.Helper
Source = foregroundFontEffect,
AlphaMask = mask,
},
BlurAmount = (float)glowEffectAmount,
BlurAmount = (float)Math.Clamp(glowEffectAmount, 0, 100),
Optimization = EffectOptimization.Speed,
};
}
@@ -358,7 +358,7 @@ namespace BetterLyrics.WinUI3.Helper
Source = foregroundFontEffect,
AlphaMask = mask,
},
Opacity = (float)opacity,
Opacity = (float)Math.Clamp(opacity, 0, 1),
};
}
@@ -372,7 +372,7 @@ namespace BetterLyrics.WinUI3.Helper
AlphaMask = mask,
},
ShadowColor = shadowColor,
BlurAmount = (float)shadowAmount,
BlurAmount = (float)Math.Clamp(shadowAmount, 0, 100),
Optimization = EffectOptimization.Speed,
};
}
@@ -386,7 +386,7 @@ namespace BetterLyrics.WinUI3.Helper
Source = foregroundFontEffect,
AlphaMask = mask,
},
Opacity = (float)opacity,
Opacity = (float)Math.Clamp(opacity, 0, 1),
};
}

View File

@@ -592,7 +592,7 @@ namespace BetterLyrics.WinUI3.Services.LyricsSearchService
lyricsSearchResult.Raw = response?.Lrc?.Lyric;
lyricsSearchResult.Translation = response?.Tlyric?.Lyric;
lyricsSearchResult.Transliteration = response?.Romalrc.Lyric;
lyricsSearchResult.Transliteration = response?.Romalrc?.Lyric;
lyricsSearchResult.Reference = $"https://music.163.com/song?id={neteaseResult.Id}";
}
else if (result is KugouSearchResult kugouResult)

View File

@@ -370,7 +370,7 @@ namespace BetterLyrics.WinUI3.ViewModels.LyricsRendererViewModel
combinedDs.DrawImage(new OpacityEffect
{
Source = effectLayer,
Opacity = (float)Math.Max(line.HighlightOpacityTransition.Value * _lyricsOpacityTransition.Value, 0),
Opacity = (float)Math.Clamp(line.HighlightOpacityTransition.Value * _lyricsOpacityTransition.Value, 0, 1),
});
if (i == _playingLineIndex)