Skip to content

Commit

Permalink
fix(inventory): get model name if hostname return empty value
Browse files Browse the repository at this point in the history
Signed-off-by: Teclib <skita@teclib.com>
  • Loading branch information
stonebuzz committed Nov 8, 2019
1 parent 0587aee commit 101a624
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import android.content.Context;
import android.os.Build;
import android.provider.Settings.Secure;
import android.util.Log;

import org.flyve.inventory.CommonErrorType;
import org.flyve.inventory.FlyveLog;
Expand Down Expand Up @@ -239,6 +240,12 @@ public String getName() {
} catch (Exception ex) {
FlyveLog.e(FlyveLog.getMessage(context, CommonErrorType.HARDWARE_NAME, ex.getMessage()));
}

//name cannot be empty (for glpi inventory)
if(value.isEmpty()){
value = Build.MODEL;
}

return value.trim();
}

Expand Down

0 comments on commit 101a624

Please sign in to comment.