summary refs log tree commit diff
path: root/crypto/src/asn1
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/asn1')
-rw-r--r--crypto/src/asn1/BEROctetStringGenerator.cs36
1 files changed, 17 insertions, 19 deletions
diff --git a/crypto/src/asn1/BEROctetStringGenerator.cs b/crypto/src/asn1/BEROctetStringGenerator.cs
index bed40b566..7893139d6 100644
--- a/crypto/src/asn1/BEROctetStringGenerator.cs
+++ b/crypto/src/asn1/BEROctetStringGenerator.cs
@@ -108,31 +108,29 @@ namespace Org.BouncyCastle.Asn1
             {
                 if (disposing)
                 {
-				    if (_off != 0)
-				    {
-					    DerOctetString.Encode(_derOut, true, _buf, 0, _off);
-				    }
-
-                    _derOut.FlushInternal();
-
-				    _gen.WriteBerEnd();
+                    ImplClose();
                 }
                 base.Dispose(disposing);
             }
 #else
-			public override void Close()
-			{
-				if (_off != 0)
-				{
-					DerOctetString.Encode(_derOut, _buf, 0, _off);
-				}
+            public override void Close()
+            {
+                ImplClose();
+                base.Close();
+            }
+#endif
+
+            private void ImplClose()
+            {
+                if (_off != 0)
+                {
+                    DerOctetString.Encode(_derOut, _buf, 0, _off);
+                }
 
                 _derOut.FlushInternal();
 
                 _gen.WriteBerEnd();
-				base.Close();
-			}
-#endif
-		}
-	}
+            }
+        }
+    }
 }