From 70bc9bbd5c4cca9e55be1beebed63704d7bb95e8 Mon Sep 17 00:00:00 2001 From: haiduong87 Date: Sun, 24 Jul 2022 10:00:36 +0200 Subject: [PATCH] Check condition before dispose "ObjectStreamData" (#651) --- Minio/DataModel/ObjectOperationsArgs.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Minio/DataModel/ObjectOperationsArgs.cs b/Minio/DataModel/ObjectOperationsArgs.cs index 2886c3792..d82c5b2a3 100644 --- a/Minio/DataModel/ObjectOperationsArgs.cs +++ b/Minio/DataModel/ObjectOperationsArgs.cs @@ -1891,6 +1891,7 @@ public PutObjectArgs WithStreamData(Stream data) ~PutObjectArgs() { - if (ObjectStreamData != null) ObjectStreamData.Close(); + if (!string.IsNullOrWhiteSpace(FileName) && ObjectStreamData != null) + ObjectStreamData.Close(); } } \ No newline at end of file