https://bugs.kde.org/show_bug.cgi?id=518361

            Bug ID: 518361
           Summary: Plasmoid FullRepresentation.qml: TypeError in
                    getPlanStatus() when DataSource not yet loaded
    Classification: Applications
           Product: kup
      Version First 0.10.0
       Reported In:
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

The Kup plasmoid's FullRepresentation.qml throws multiple TypeErrors on every
session startup because getPlanStatus() lacks 
  a null/undefined check. The backupPlans DataSource has not yet loaded plan
data when the QML delegate tries to access it,   
  causing backupPlans.data["plan 0"] to be undefined.                   

  This can prevent the plasmoid from correctly initializing and may interfere
with scheduled backup triggering.               

  Steps to reproduce:                                                           
  1. Configure a Kup backup plan with an external drive as destination  
  2. Log in to a Plasma 6 session with the Kup applet in the system tray        
  3. Observe journal output: journalctl --user -t plasmashell                   

  Expected behavior:                                                            
  No errors; the plasmoid gracefully handles the DataSource not being ready
yet.                                              

  Actual behavior:                                                      
  Multiple TypeErrors at FullRepresentation.qml:137:                            

    TypeError: Cannot read property 'description' of undefined                  
    TypeError: Cannot read property 'status heading' of undefined               
    TypeError: Cannot read property 'status details' of undefined               
    TypeError: Cannot read property 'icon name' of undefined                    
    TypeError: Cannot read property 'destination available' of undefined        
    TypeError: Cannot read property 'bup type' of undefined                     
    TypeError: Cannot read property 'log file exists' of undefined              

  Root cause:                                                                   
  In plasmoid-qt6/contents/ui/FullRepresentation.qml, line 136-138:             

    function getPlanStatus(planNumber, key){                                    
        return backupPlans.data["plan " + planNumber.toString()][key];          
    }                                                                           

  backupPlans.data["plan 0"] is undefined when the Plasma5Support DataSource
hasn't connected yet. By contrast,               
  getCommonStatus() in main.qml already handles this correctly with a fallback
check.

  Suggested fix:                                                        
  Add null-safety to getPlanStatus(), matching the pattern used in
getCommonStatus():

    function getPlanStatus(planNumber, key){                                    
        var plan = backupPlans.data["plan " + planNumber.toString()];           
        if(plan === undefined) return "";                                       
        return plan[key];                                                       
    }                                                                           

  The same issue also exists in
plasmoid-qt5/contents/ui/FullRepresentation.qml.                                

  Environment:                                                                  
  - Kup 0.10.0 
  - KDE Plasma 6.5.2                                                      
  - Qt 6.9.2                                              
  - KDE Frameworks 5.116.0                                                      
  - Linux (TUXEDO OS 24.04 / Ubuntu Noble base)

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to