Bugfix: the array need to have a lenght of at least 2

This commit is contained in:
Laurent Clouet
2015-05-06 20:04:28 +01:00
parent 02bc6ab21f
commit 39addc82ef

View File

@@ -57,21 +57,21 @@ public class Linux extends OS {
String line = scanner.nextLine();
if (line.startsWith("model name")) {
String buf[] = line.split(":");
if (buf.length > 0) {
if (buf.length > 1) {
ret.setName(buf[1].trim());
}
}
if (line.startsWith("cpu family")) {
String buf[] = line.split(":");
if (buf.length > 0) {
if (buf.length > 1) {
ret.setFamily(buf[1].trim());
}
}
if (line.startsWith("model") && line.startsWith("model name") == false) {
String buf[] = line.split(":");
if (buf.length > 0) {
if (buf.length > 1) {
ret.setModel(buf[1].trim());
}
}