From 9b4a06e57370767fbc20601383f6d198fd08f1f2 Mon Sep 17 00:00:00 2001 From: Michael Zillgith Date: Wed, 31 Oct 2018 10:14:50 +0100 Subject: [PATCH] - .NET API: ReportControlBlock.GetOwner returns null when no owner available (#79) --- dotnet/IEC61850forCSharp/ReportControlBlock.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/dotnet/IEC61850forCSharp/ReportControlBlock.cs b/dotnet/IEC61850forCSharp/ReportControlBlock.cs index 0abae209..9e6daecf 100644 --- a/dotnet/IEC61850forCSharp/ReportControlBlock.cs +++ b/dotnet/IEC61850forCSharp/ReportControlBlock.cs @@ -742,14 +742,19 @@ namespace IEC61850 /// /// Gets the current owner of the RCB /// - /// The owner information + /// The owner information, or null when no owner information is available. public byte[] GetOwner() { IntPtr mmsValuePtr = ClientReportControlBlock_getOwner(self); - MmsValue octetStringVal = new MmsValue(mmsValuePtr); + if (mmsValuePtr != IntPtr.Zero) + { + MmsValue octetStringVal = new MmsValue(mmsValuePtr); - return octetStringVal.getOctetString(); + return octetStringVal.getOctetString(); + } + else + return null; } }