Skip to content

Commit

Permalink
chore(agent): add check to ensure major version is not null
Browse files Browse the repository at this point in the history
  • Loading branch information
hahuja2 committed Mar 27, 2024
1 parent 9ff6234 commit 3d36800
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions agent/fw_support.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,11 @@ void nr_fw_support_add_package_supportability_metric(
}

char* metname = NULL;
char major_version[4];
char major_version[4] = {0};

/* The below for loop checks if the major version of the package is more than
* one digit and keeps looping until a '.' is encountered or one of the conditions is met.
* one digit and keeps looping until a '.' is encountered or one of the
* conditions is met.
*/
for (int i = 0; package_version[i] && i < 4; i++) {
if ('.' == package_version[i]) {
Expand All @@ -75,6 +76,10 @@ void nr_fw_support_add_package_supportability_metric(
}
}

if ('\0' == major_version[0]) {
return;
}

if (NR_FW_UNSET == NRINI(force_framework)) {
metname = nr_formatf("Supportability/PHP/package/%s/%s/detected",
package_name, major_version);
Expand Down

0 comments on commit 3d36800

Please sign in to comment.