Permalink
Browse files

Add checks for a null container to resume gracefully

  • Loading branch information...
1 parent 36a09ce commit 64abf00f733d363c8d0ac2248dd886f0775557a5 @scottdensmore scottdensmore committed Nov 14, 2013
@@ -39,6 +39,10 @@ public override Task<Response> HandleAsync()
log.Trace("SrcPath: '{0}' DstPath: '{1}'", request.SrcPath, request.DstPath);
Container container = GetContainer();
+ if (container == null)
+ {
+ return copyResponse;
+ }
string sourcePath = container.ConvertToPathWithin(request.SrcPath);
@@ -31,21 +31,24 @@ public override Task<Response> HandleAsync()
return Task.Run<Response>(() =>
{
Container container = GetContainer();
- if (container.State != ContainerState.Stopped)
+ if (container != null)
{
- try
+ if (container.State != ContainerState.Stopped)
{
- var stopRequest = new StopRequest { Handle = request.Handle };
- var stopRequestHandler = new StopRequestHandler(containerManager, stopRequest);
- var stopTask = stopRequestHandler.HandleAsync();
- Response stopResponse = stopTask.Result;
- }
- catch (Exception ex)
- {
- log.WarnException(ex);
+ try
+ {
+ var stopRequest = new StopRequest { Handle = request.Handle };
+ var stopRequestHandler = new StopRequestHandler(containerManager, stopRequest);
+ var stopTask = stopRequestHandler.HandleAsync();
+ Response stopResponse = stopTask.Result;
+ }
+ catch (Exception ex)
+ {
+ log.WarnException(ex);
+ }
}
+ containerManager.DestroyContainer(container);
}
- containerManager.DestroyContainer(container);
return new DestroyResponse();
});
}

0 comments on commit 64abf00

Please sign in to comment.