mirror of
https://github.com/opencv/opencv.git
synced 2025-01-18 14:13:15 +08:00
OpenCV Manager crashes with exception (Bug #2660)
String checking and range cheching added.
This commit is contained in:
parent
014a500f79
commit
064bf167ad
@ -402,7 +402,13 @@ public class ManagerActivity extends Activity
|
|||||||
|
|
||||||
protected String NormalizeVersion(String OpenCVersion, String PackageVersion)
|
protected String NormalizeVersion(String OpenCVersion, String PackageVersion)
|
||||||
{
|
{
|
||||||
|
if (OpenCVersion == null || PackageVersion == null)
|
||||||
|
return "unknown";
|
||||||
|
|
||||||
int dot = PackageVersion.indexOf(".");
|
int dot = PackageVersion.indexOf(".");
|
||||||
|
if (dot == -1 || OpenCVersion.length() == 0)
|
||||||
|
return "unknown";
|
||||||
|
else
|
||||||
return OpenCVersion.substring(0, OpenCVersion.length()-1) + "." +
|
return OpenCVersion.substring(0, OpenCVersion.length()-1) + "." +
|
||||||
OpenCVersion.toCharArray()[OpenCVersion.length()-1] + "." +
|
OpenCVersion.toCharArray()[OpenCVersion.length()-1] + "." +
|
||||||
PackageVersion.substring(0, dot) + " rev " + PackageVersion.substring(dot+1);
|
PackageVersion.substring(0, dot) + " rev " + PackageVersion.substring(dot+1);
|
||||||
|
Loading…
Reference in New Issue
Block a user