Fix android crash when model detects nothing
authorZhizhen Qin <eliqinzz@gmail.com>
Fri, 15 Feb 2019 01:22:34 +0000 (17:22 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Fri, 15 Feb 2019 01:29:14 +0000 (17:29 -0800)
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

binaries/benchmark_helper.h

index 8c24a3d..d09ba4e 100644 (file)
@@ -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