I am trying to send an automated email to a bunch of people in my office using Google Apps Script from a Google Sheet. We built it and it worked fine but now we have to add another recipient for each email as a CC. This isn't a huge problem either but I cant figure out how to ignore the null values (not all have a second person to CC). Here is my script, I might just be nesting the if statement incorrectly?
  for (var i = 0; i <= numRows - 1; i++) {
var priorityValues = priority[i][0];
var autostatValues = autostat[i][0];
if(priorityValues == 'P0' && autostatValues != 'Launched') {
  // if it's P0, do something with the data.
  var emailFinal = email[i][0] + '@company.com';
  var ttFinal = tt[i][0] + '@company.com';
  var bugFinal = bugNumber[i][0];
  var sumFinal = sumtotal[i][0];
  var subject = 'Please update your info';
  var msg = 
  '<html><body>message is here
  </body></html>'
    ;
   if(tt[i][0] !== null) {  
    MailApp.sendEmail(emailFinal, subject, "", {htmlBody: msg, noReply:true, cc: ttFinal})}
  else {
    MailApp.sendEmail(emailFinal, subject, "", {htmlBody: msg, noReply:true})}
        }
}
 
    