2015-04-29 update 1 Fix the bug in AddressFormater again

This commit is contained in:
parallelbgls@outlook.com
2015-04-29 10:29:42 +08:00
parent a33423ab9e
commit 6009d656ba

View File

@@ -15,7 +15,8 @@ namespace ModBus.Net
{
public override string FormatAddress(string area, int address)
{
if (area.ToUpper().Substring(0,2) == "DB")
if (area.Length > 1 &&
area.ToUpper().Substring(0,2) == "DB")
{
return area.ToUpper() + "." + "DB" + address;
}