mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-31 15:12:06 +00:00 
			
		
		
		
	nullptr
This commit is contained in:
		| @@ -282,8 +282,7 @@ class Scheduler { | |||||||
|  |  | ||||||
|   // Helper to mark matching items in a container as removed |   // Helper to mark matching items in a container as removed | ||||||
|   // Returns the number of items marked for removal |   // Returns the number of items marked for removal | ||||||
|   // For ESPHOME_THREAD_MULTI_NO_ATOMICS platforms, the caller must hold the scheduler lock before calling this |   // IMPORTANT: Caller must hold the scheduler lock before calling this function. | ||||||
|   // function. |  | ||||||
|   template<typename Container> |   template<typename Container> | ||||||
|   size_t mark_matching_items_removed_(Container &container, Component *component, const char *name_cstr, |   size_t mark_matching_items_removed_(Container &container, Component *component, const char *name_cstr, | ||||||
|                                       SchedulerItem::Type type, bool match_retry) { |                                       SchedulerItem::Type type, bool match_retry) { | ||||||
| @@ -291,8 +290,8 @@ class Scheduler { | |||||||
|     for (auto &item : container) { |     for (auto &item : container) { | ||||||
|       // Skip nullptr items (can happen in defer_queue_ when items are being processed) |       // Skip nullptr items (can happen in defer_queue_ when items are being processed) | ||||||
|       // The defer_queue_ uses index-based processing: items are std::moved out but left in the |       // The defer_queue_ uses index-based processing: items are std::moved out but left in the | ||||||
|       // vector as nullptr until cleanup. If cancel_item_locked_() is called from a callback during |       // vector as nullptr until cleanup. Even though this function is called with lock held, | ||||||
|       // defer queue processing, it will iterate over these nullptr items. This check prevents crashes. |       // the vector can still contain nullptr items from the processing loop. This check prevents crashes. | ||||||
|       if (!item) |       if (!item) | ||||||
|         continue; |         continue; | ||||||
|       if (this->matches_item_(item, component, name_cstr, type, match_retry)) { |       if (this->matches_item_(item, component, name_cstr, type, match_retry)) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user