add null check for EnumWriteProtocol

add null check for EnumWriteProtocol