unpoller / unifi

Go Library (w/ structures) to grab data from a Ubitquiti UniFi Controller
https://golift.io/discord
MIT License
114 stars 22 forks source link

Use pointers.... #26

Closed davidnewhall closed 5 years ago

davidnewhall commented 5 years ago

A bug was reported causing a crash because a pointer was never set. This contribution fixes that by setting the pointer if it's nil. I also added a very basic test that will throw a panic if the unmarshal operation fails on an empty data set. Before the fix the test failed, now it succeeds.

I also went through and cleaned up all the methods so they use pointers correctly. This should reduce the memory footprint by a few bytes by not copying data between Points and PointsAt.