diff --git a/dlls/wbemprox/class.c b/dlls/wbemprox/class.c index 75bd612bd16..994e76b6f72 100644 --- a/dlls/wbemprox/class.c +++ b/dlls/wbemprox/class.c @@ -568,19 +568,23 @@ static BSTR get_body_text( const struct table *table, UINT row, UINT *len ) *len = 0; for (i = 0; i < table->num_cols; i++) { - *len += sizeof(fmtW) / sizeof(fmtW[0]); - *len += strlenW( table->columns[i].name ); - value = get_value_bstr( table, row, i ); - *len += SysStringLen( value ); - SysFreeString( value ); + if ((value = get_value_bstr( table, row, i ))) + { + *len += sizeof(fmtW) / sizeof(fmtW[0]); + *len += strlenW( table->columns[i].name ); + *len += SysStringLen( value ); + SysFreeString( value ); + } } if (!(ret = SysAllocStringLen( NULL, *len ))) return NULL; p = ret; for (i = 0; i < table->num_cols; i++) { - value = get_value_bstr( table, row, i ); - p += sprintfW( p, fmtW, table->columns[i].name, value ); - SysFreeString( value ); + if ((value = get_value_bstr( table, row, i ))) + { + p += sprintfW( p, fmtW, table->columns[i].name, value ); + SysFreeString( value ); + } } return ret; } diff --git a/dlls/wbemprox/table.c b/dlls/wbemprox/table.c index 43ab91d0f21..c114e532d82 100644 --- a/dlls/wbemprox/table.c +++ b/dlls/wbemprox/table.c @@ -166,6 +166,7 @@ BSTR get_value_bstr( const struct table *table, UINT row, UINT column ) case CIM_DATETIME: case CIM_STRING: + if (!val) return NULL; len = strlenW( (const WCHAR *)(INT_PTR)val ) + 2; if (!(ret = SysAllocStringLen( NULL, len ))) return NULL; sprintfW( ret, fmt_strW, (const WCHAR *)(INT_PTR)val );