Skip to content

Commit

Permalink
refactor(server): Nest if to prevent checking two times for the same …
Browse files Browse the repository at this point in the history
…condition
  • Loading branch information
schdck committed Apr 14, 2020
1 parent 30744c8 commit 04290e7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions RemoteFlix.Base/RemoteFlixServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -213,12 +213,12 @@ private bool ExecuteCommand(BasePlayer player, PlayerCommand command)
if (playerHandle == null)
{
playerHandle = KeyboardSimulationHelper.GetForegroundWindow();
}

// If this also fails, there isn't much we can do
if(playerHandle == null || playerHandle.Value == IntPtr.Zero)
{
return false;
// If this also fails, there isn't much we can do
if (playerHandle.Value == IntPtr.Zero)
{
return false;
}
}

KeyboardSimulationHelper.SendKeys(playerHandle.Value, command.ActionShortcut);
Expand Down
2 changes: 1 addition & 1 deletion RemoteFlix.UI.Desktop/ViewModel/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ private void SetupEnvironment()
private void LogReceived(object sender, NotifyCollectionChangedEventArgs e)
{
// It is safe to do this since there's only one method to modify the collection and it
// adds (one) log. So every time the collection changes it is an addition of one item.
// adds *one* log. So every time the collection changes it is an addition of one item.
var log = e.NewItems[0] as Log;

Application.Current.Dispatcher.Invoke(() => Logs.Add(log));
Expand Down

0 comments on commit 04290e7

Please sign in to comment.