mirror of
https://github.com/chylex/Backup-Essentials.git
synced 2025-08-04 15:59:07 +02:00
Check for InvalidOperationException when working with processes
This commit is contained in:
parent
d3b72b0dad
commit
52270283ab
@ -77,7 +77,13 @@ namespace BackupEssentials{
|
||||
/// Runs the program without any special settings. Checks for already running process of the program, if there is one it moves it to foreground, if not it shows a new window.
|
||||
/// </summary>
|
||||
private void RunMainWindow(){
|
||||
Process[] running = Process.GetProcessesByName(Path.GetFileNameWithoutExtension(Assembly.GetEntryAssembly().Location));
|
||||
Process[] running;
|
||||
|
||||
try{
|
||||
running = Process.GetProcessesByName(Path.GetFileNameWithoutExtension(Assembly.GetEntryAssembly().Location));
|
||||
}catch(InvalidOperationException e){
|
||||
running = new Process[0];
|
||||
}
|
||||
|
||||
if (running.Length > 1){
|
||||
int myId = Process.GetCurrentProcess().Id;
|
||||
|
Loading…
Reference in New Issue
Block a user