Fix error on invalid resource item.

This commit is contained in:
2023-11-13 00:36:30 +08:00
parent 4ca5809597
commit 2778725b91
2 changed files with 21 additions and 15 deletions

View File

@@ -43,12 +43,18 @@ namespace Cryville.Crtr.Browsing.UI {
m_cover.sprite = m_coverPlaceholder;
if (data.Cover != null) data.Cover.Destination = DisplayCover;
var meta = data.Meta;
m_title.text = string.Format("{0}\n{1}", meta.song.name, meta.name);
m_desc.text = string.Format(
"Music artist: {0}\nCharter: {1}\nLength: {2}\nNote Count: {3}",
meta.song.author, meta.author,
TimeSpan.FromSeconds(meta.length).ToString(3), meta.note_count
);
if (meta != null) {
m_title.text = string.Format("{0}\n{1}", meta.song.name, meta.name);
m_desc.text = string.Format(
"Music artist: {0}\nCharter: {1}\nLength: {2}\nNote Count: {3}",
meta.song.author, meta.author,
TimeSpan.FromSeconds(meta.length).ToString(3), meta.note_count
);
}
else {
m_title.text = "<color=#ff0000>Invalid resource</color>";
m_desc.text = string.Empty;
}
}
private void DisplayCover(bool succeeded, Texture2D tex) {
if (succeeded) {