Skip to content

Commit 64dc053

Browse files
committedJul 4, 2015
Fix endless loop since grandparent commit
1 parent c53520a commit 64dc053

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed
 

Diff for: ‎src/craftdef.cpp

+10-8
Original file line numberDiff line numberDiff line change
@@ -242,12 +242,13 @@ static std::string craftDumpMatrix(const std::vector<std::string> &items,
242242
{
243243
std::ostringstream os(std::ios::binary);
244244
os << "{ ";
245+
unsigned int x = 0;
245246
for(std::vector<std::string>::size_type i = 0;
246-
i < items.size(); i++) {
247-
if (i == width) {
247+
i < items.size(); i++, x++) {
248+
if (x == width) {
248249
os << "; ";
249-
i = 0;
250-
} else if (i != 0) {
250+
x = 0;
251+
} else if (x != 0) {
251252
os << ",";
252253
}
253254
os << '"' << items[i] << '"';
@@ -262,12 +263,13 @@ std::string craftDumpMatrix(const std::vector<ItemStack> &items,
262263
{
263264
std::ostringstream os(std::ios::binary);
264265
os << "{ ";
266+
unsigned int x = 0;
265267
for (std::vector<ItemStack>::size_type i = 0;
266-
i < items.size(); i++) {
267-
if (i == width) {
268+
i < items.size(); i++, x++) {
269+
if (x == width) {
268270
os << "; ";
269-
i = 0;
270-
} else if (i != 0) {
271+
x = 0;
272+
} else if (x != 0) {
271273
os << ",";
272274
}
273275
os << '"' << (items[i].getItemString()) << '"';

0 commit comments

Comments
 (0)
Please sign in to comment.