From 9f3c8035526a85e3a17400139dcd4fe986b98b57 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 26 Aug 2018 08:40:35 +0100 Subject: [PATCH] avoid potencial null refs --- OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 79f495290a..2819bc9daf 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -637,11 +637,11 @@ namespace OpenSim.Framework.Servers.HttpServer { try { + if(request.InputStream != null && request.InputStream.CanRead) + request.InputStream.Close(); byte[] buffer500 = SendHTML500(response); response.OutputStream.Write(buffer500, 0, buffer500.Length); response.Send(); - if(request.InputStream.CanRead) - request.InputStream.Close(); } catch { @@ -829,7 +829,7 @@ namespace OpenSim.Framework.Servers.HttpServer } } - if(request.InputStream.CanRead) + if(request.InputStream != null && request.InputStream.CanRead) request.InputStream.Dispose(); if (buffer != null) @@ -894,7 +894,7 @@ namespace OpenSim.Framework.Servers.HttpServer } finally { - if(request.InputStream.CanRead) + if(request.InputStream != null && request.InputStream.CanRead) request.InputStream.Close(); // Every month or so this will wrap and give bad numbers, not really a problem