File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change 47
47
48
48
% Build line protocol
49
49
function str = build(obj )
50
- builder = java .lang .StringBuilder();
51
- for i = 1 : length(obj .Items )
52
- item = obj.Items{i };
53
- builder .append(item .toLine(obj .Precision ));
54
- builder .append(newline );
50
+ if isempty(obj .Items )
51
+ warning(' this writer is empty' );
52
+ str = ' ' ;
53
+ else
54
+ builder = java .lang .StringBuilder();
55
+ for i = 1 : length(obj .Items )
56
+ item = obj.Items{i };
57
+ builder .append(item .toLine(obj .Precision ));
58
+ builder .append(newline );
59
+ end
60
+ builder .deleteCharAt(int32(builder .length() - 1 ));
61
+ str = char(builder .toString());
55
62
end
56
- builder .deleteCharAt(int32(builder .length() - 1 ));
57
- str = char(builder .toString());
58
63
end
59
64
60
65
% Execute the write
You can’t perform that action at this time.
0 commit comments