@@ -97,6 +97,7 @@ public WebUntisClient(string clientName, int timeout = 500)
9797 /// <exception cref="ArgumentException">The server name is invalid</exception>
9898 /// <exception cref="HttpRequestException">There was an error while the request</exception>
9999 /// <exception cref="WebUntisException">The WebUntis server returned an error</exception>
100+ /// <exception cref="ObjectDisposedException">Thrown when the object is disposed</exception>
100101 public async Task < bool > LoginAsync ( School school , string username , string password , string id = "getStudents" , CancellationToken ct = default ) =>
101102 await LoginAsync ( school . Server , school . LoginName , username , password , id , ct ) ;
102103
@@ -116,8 +117,13 @@ public async Task<bool> LoginAsync(School school, string username, string passwo
116117 /// <exception cref="ArgumentException">The server name is invalid</exception>
117118 /// <exception cref="HttpRequestException">There was an error while the request</exception>
118119 /// <exception cref="WebUntisException">The WebUntis server returned an error</exception>
120+ /// <exception cref="ObjectDisposedException">Thrown when the object is disposed</exception>
119121 public async Task < bool > LoginAsync ( string server , string loginName , string username , string password , string id = "getStudents" , CancellationToken ct = default )
120122 {
123+ // Check for disposing
124+ if ( _disposedValue )
125+ throw new ObjectDisposedException ( GetType ( ) . FullName ) ;
126+
121127 // Check if you already logged in
122128 if ( LoggedIn )
123129 return false ;
@@ -186,8 +192,13 @@ public async Task<bool> LoginAsync(string server, string loginName, string usern
186192 /// <param name="ct">Cancellation token</param>
187193 /// <returns>Task for the proccess</returns>
188194 /// <exception cref="HttpRequestException">There was an error while the request</exception>
195+ /// <exception cref="ObjectDisposedException">Thrown when the object is disposed</exception>
189196 public async Task LogoutAsync ( string id = "getStudents" , CancellationToken ct = default )
190197 {
198+ // Check for disposing
199+ if ( _disposedValue )
200+ throw new ObjectDisposedException ( GetType ( ) . FullName ) ;
201+
191202 // Check if you logged in
192203 if ( ! LoggedIn )
193204 return ;
0 commit comments