Skip to content

Commit 8de3772

Browse files
committed
code_style: remove Rider warnings
Signed-off-by: leo <[email protected]>
1 parent daba8e5 commit 8de3772

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

src/ViewModels/CommitDetail.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ public void ViewRevisionFile(Models.Object file)
196196
var stream = Commands.QueryFileContent.Run(_repo.FullPath, _commit.SHA, file.Path);
197197
var fileSize = stream.Length;
198198
var bitmap = fileSize > 0 ? new Bitmap(stream) : null;
199-
var imageType = Path.GetExtension(file.Path).TrimStart('.').ToUpper(CultureInfo.CurrentCulture);
199+
var imageType = ext!.Substring(1).ToUpper(CultureInfo.CurrentCulture);
200200
var image = new Models.RevisionImageFile() { Image = bitmap, FileSize = fileSize, ImageType = imageType };
201201
Dispatcher.UIThread.Invoke(() => ViewRevisionFileContent = image);
202202
}

src/ViewModels/Histories.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,9 @@ public void Select(IList commits)
153153
}
154154
else if (commits.Count == 1)
155155
{
156-
var commit = commits[0] as Models.Commit;
157-
156+
var commit = (commits[0] as Models.Commit)!;
158157
if (_repo.SearchResultSelectedCommit == null || _repo.SearchResultSelectedCommit.SHA != commit.SHA)
159-
{
160158
_repo.SearchResultSelectedCommit = _repo.SearchedCommits.Find(x => x.SHA == commit.SHA);
161-
}
162159

163160
AutoSelectedCommit = commit;
164161
NavigationId = _navigationId + 1;
@@ -224,7 +221,7 @@ public void DoubleTapped(Models.Commit commit)
224221
public ContextMenu MakeContextMenu(ListBox list)
225222
{
226223
var current = _repo.CurrentBranch;
227-
if (current == null)
224+
if (current == null || list.SelectedItems == null)
228225
return null;
229226

230227
if (list.SelectedItems.Count > 1)

0 commit comments

Comments
 (0)