EnAccess / EnAccess/micropowermanager

[Bug]: Agent information update missing fields egde cases

Open
#1,450 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
PHP
Stars
27
Forks
19
Avg merge
1d 18h
Merged PRs (30d)
27

Description

### Preflight Checklist

- [x] I have read the [Contributing Guidelines](https://github.com/EnAccess/micropowermanager/blob/main/CONTRIBUTING.md) for this project, if it exists.
- [x] I agree to follow the [Code of Conduct](https://github.com/EnAccess/micropowermanager/blob/main/CODE_OF_CONDUCT.md) that this project adheres to.
- [x] I have searched the [issue tracker](https://github.com/EnAccess/micropowermanager/issues) for a feature request that matches the one I want to file, without success.

### Expected Behavior

`AgentService` should properly handle agent information update with missing fields.

### Actual Behavior

Web request with missing fields leads to 500 error

```php
{
   "class": "ErrorException",
   "message": "Undefined array key \"name\"",
   "code": 0,
   "file": "/var/www/html/app/Services/AgentService.php:153",
   "trace": [
       "/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php:258",
       "/var/www/html/app/Services/AgentService.php:153",
       "/var/www/html/app/Http/Controllers/AgentWebController.php:78",
       "/var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Controller.php:54",
```

### Steps to reproduce

N/A

### What operating system(s) are you using?

Ubuntu

### Additional Information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.