check for Null-version...

FossilOrigin-Name: 7dfa074be5eeb13f8dd9a8b648f028d03414271558ba3747a4428e3980915a1e
This commit is contained in:
7u83@mail.ru 2015-03-15 16:23:02 +00:00
parent e18dbf3bf1
commit a5de50b390

View File

@ -41,13 +41,14 @@
*/ */
int cw_format_version(char *s, bstr_t ver, uint32_t vendor, char * def) int cw_format_version(char *s, bstr_t ver, uint32_t vendor, char * def)
{ {
if (!ver)
return sprintf(s,"%s",def);
uint8_t * version = bstr_data(ver); uint8_t * version = bstr_data(ver);
int len = bstr_len(ver); int len = bstr_len(ver);
if (!version)
return sprintf(s,"%s",def);
int rs=0; int rs=0;
int i; int i;
@ -76,9 +77,8 @@ int cw_format_version(char *s, bstr_t ver, uint32_t vendor, char * def)
rs+=sprintf(s+rs,")"); rs+=sprintf(s+rs,")");
} }
if (vendor)
rs+=sprintf(s+rs,", Vendor Id: %d, %s",vendor, cw_ianavendoridtostr(vendor)); rs+=sprintf(s+rs,", Vendor Id: %d, %s",vendor, cw_ianavendoridtostr(vendor));
rs+=sprintf(s+rs,"\n");
return rs; return rs;
} }