From: Zhizhen Qin Date: Fri, 15 Feb 2019 01:22:34 +0000 (-0800) Subject: Fix android crash when model detects nothing X-Git-Tag: accepted/tizen/6.5/unified/20211028.231830~1274 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6a467389863aa360cf09715dc5c0301805abb44e;p=platform%2Fupstream%2Fpytorch.git Fix android crash when model detects nothing Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/17119 Reviewed By: sf-wind Differential Revision: D14087835 Pulled By: ZhizhenQin fbshipit-source-id: 32e61d46679bae645fd0bbec724513cfa5c553ab --- diff --git a/binaries/benchmark_helper.h b/binaries/benchmark_helper.h index 8c24a3d..d09ba4e 100644 --- a/binaries/benchmark_helper.h +++ b/binaries/benchmark_helper.h @@ -82,7 +82,9 @@ void writeTextOutput( } // remove the last , string str = line.str(); - str.pop_back(); + if(str.length() != 0) { + str.pop_back(); + } lines.push_back(str); // static casts are workaround for MSVC build