[SalesForce] Error on apex trigger how to specify id in this program

Apex trigger quotepotential caused an unexpected exception, contact your administrator: quotepotential: execution of AfterInsert caused by: System.DmlException: Update failed. First exception on row 0; first error: MISSING_ARGUMENT, Id not specified in an update call: []: Trigger.quotepotential: line 10, column 1

thsi is the error i am getting how to clear this error

trigger quotepotential on Quote_Line_Item__c (after insert, after update) {
    Set<Id> quoteIds = new Set<Id>();
    List<Quote__c> quotes = new List<Quote__c>();
    for(Quote_Line_Item__c record: Trigger.new) {
        quoteIds.add(record.Quote1__c);
    }
    for(AggregateResult ar:[SELECT Quote1__c id, SUM(Max_Batch__c)sumMax FROM Quote_Line_Item__c WHERE Quote1__c=:quoteIds GROUP BY Quote1__c]) {
       quotes.add(new Quote__c(Id=(Id)ar.get('Id'), Potential__c=(Decimal)ar.get('sumMax')));
}
  update quotes;
}

Best Answer

are you sure that quote1__c is not null ?? can you please try filtering out nulls ?

   for(Quote_Line_Item__c record: Trigger.new) {
        if (record.Quote1__c != null)
        {
           quoteIds.add(record.Quote1__c);
        }
   }