#vulnerable code 
                              private static void getQualityGate(WsClient client, ProjectInformation proj, String projectKey, float version) throws Exception {
    ProjectQualityGate qg;
    if (version < 5.2f) {
      qg = client.getQualityGateBefore52(projectKey);
    } else {
      qg = client.getQualityGate52(projectKey);
    }
    proj.setStatus(qg.getStatus());

    if (qg.getProjectName() != null) {
      proj.setName(qg.getProjectName());
    }
  } 
                            #location 8 
                            #vulnerability type NULL_DEREFERENCE
#fixed code
                              private static void getQualityGate(WsClient client, ProjectInformation proj, String projectKey, float version) throws Exception {
    ProjectQualityGate qg;
    if (version < 5.2f) {
      qg = client.getQualityGateBefore52(projectKey);
    } else {
      qg = client.getQualityGate52(projectKey);
    }

    // happens in LTS if project is not assigned to a QG and there is no default QG
    if (qg == null) {
      return;
    }
    
    proj.setStatus(qg.getStatus());

    if (qg.getProjectName() != null) {
      proj.setName(qg.getProjectName());
    }
  }