Skip to content

Commit

Permalink
Remove un-need null check
Browse files Browse the repository at this point in the history
  • Loading branch information
andy840119 committed Feb 25, 2023
1 parent b941798 commit 6d568c9
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ private void setTooltip(string testName, Action<Singer> callBack)
AddStep(testName, () =>
{
var singer = new Singer(1);
callBack?.Invoke(singer);
callBack(singer);
toolTip.SetContent(singer);
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public SingerContextMenu(EditorBeatmap beatmap, ILyricSingerChangeHandler lyricS
var karaokeBeatmap = EditorBeatmapUtils.GetPlayableBeatmap(beatmap);
var singers = karaokeBeatmap.SingerInfo.GetAllSingers();

Items = singers?.Select(singer => new OsuMenuItem(singer.Name, anySingerInLyric(singer) ? MenuItemType.Highlighted : MenuItemType.Standard, () =>
Items = singers.Select(singer => new OsuMenuItem(singer.Name, anySingerInLyric(singer) ? MenuItemType.Highlighted : MenuItemType.Standard, () =>
{
// if only one lyric
if (allSingerInLyric(singer))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class LanguageDetector : LyricPropertyDetector<CultureInfo?, LanguageDete
public LanguageDetector(LanguageDetectorConfig config)
: base(config)
{
var targetLanguages = config.AcceptLanguages.Where(x => x != null).ToList();
var targetLanguages = config.AcceptLanguages.ToList();

if (targetLanguages.Any())
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,11 @@ private static void attachShaders(ShaderManager shaderManager, IEnumerable<ICust
attachShaders(shaderManager, stepShader.StepShaders.ToArray());
break;

case null:
throw new InvalidCastException("shader cannot be null.");

default:
throw new InvalidCastException($"{shader?.GetType()} cannot attach shader.");
throw new InvalidCastException($"{shader.GetType()} cannot attach shader.");
}
}
}
Expand Down

0 comments on commit 6d568c9

Please sign in to comment.