Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/GitHub.App/Controllers/UIController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,7 @@ protected virtual void Dispose(bool disposing)

Debug.WriteLine("Disposing ({0})", GetHashCode());
disposables.Dispose();
if (transition != null)
transition.Dispose();
transition?.Dispose();
disposed = true;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/GitHub.App/Models/RepositoryHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public IObservable<AuthenticationResult> LogIn(string usernameOrEmail, string pa
// in multiple places in the chain below:
var saveAuthorizationToken = new Func<ApplicationAuthorization, IObservable<Unit>>(authorization =>
{
var token = authorization != null ? authorization.Token : null;
var token = authorization?.Token;
if (string.IsNullOrWhiteSpace(token))
return Observable.Return(Unit.Default);

Expand Down
2 changes: 1 addition & 1 deletion src/GitHub.App/Services/AvatarProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public IObservable<BitmapSource> GetAvatar(IAvatarContainer apiAccount)

public IObservable<Unit> InvalidateAvatar([AllowNull] IAvatarContainer apiAccount)
{
return apiAccount == null || String.IsNullOrWhiteSpace(apiAccount.Login)
return String.IsNullOrWhiteSpace(apiAccount?.Login)
? Observable.Return(Unit.Default)
: cache.Invalidate(apiAccount.Login);
}
Expand Down
5 changes: 1 addition & 4 deletions src/GitHub.App/Services/GitClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ public IObservable<Unit> Push(IRepository repository, string branchName, string

return Observable.Defer(() =>
{
if (repository.Head != null
&& repository.Head != null
&& repository.Head.Commits != null
&& repository.Head.Commits.Any())
if (repository.Head?.Commits != null && repository.Head.Commits.Any())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

{
var remote = repository.Network.Remotes[remoteName];
repository.Network.Push(remote, "HEAD", @"refs/heads/" + branchName);
Expand Down
9 changes: 3 additions & 6 deletions src/GitHub.App/Services/Translation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,9 @@ protected virtual Tuple<Translation, string> Match(Exception exception)
string exceptionMessage = exception.Message;

var apiException = exception as ApiValidationException;
if (apiException != null && apiException.ApiError != null && apiException.ApiError.Errors != null)
{
var error = apiException.ApiError.Errors.FirstOrDefault();
if (error != null)
exceptionMessage = error.Message ?? exceptionMessage;
}
var error = apiException?.ApiError?.Errors?.FirstOrDefault();
if (error != null)
exceptionMessage = error.Message ?? exceptionMessage;

if (Original == exceptionMessage) return new Tuple<Translation, string>(this, null);

Expand Down
2 changes: 1 addition & 1 deletion src/GitHub.App/ViewModels/RepositoryPublishViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ void InitializeValidation()

this.WhenAny(x => x.SafeRepositoryNameWarningValidator.ValidationResult, x => x.Value)
.WhereNotNull() // When this is instantiated, it sends a null result.
.Select(result => result == null ? null : result.Message)
.Select(result => result?.Message)
.Subscribe(message =>
{
if (!string.IsNullOrEmpty(message))
Expand Down