diff --git a/src/TensorFlowNET.Core/APIs/c_api.cs b/src/TensorFlowNET.Core/APIs/c_api.cs index 6049c95c..63bdfd27 100644 --- a/src/TensorFlowNET.Core/APIs/c_api.cs +++ b/src/TensorFlowNET.Core/APIs/c_api.cs @@ -53,6 +53,11 @@ namespace Tensorflow public unsafe static byte[] ByteStringPiece(IntPtr handle) { + if (handle == IntPtr.Zero) + { + return new byte[0]; + } + byte* str_data = (byte*)handle.ToPointer(); List bytes = new List(); byte current = 255;