#vulnerable code 
                             public <T> T getDto(Type desiredDto) throws RiotApiException, RateLimitException {
		if (!response.isSuccessful()) {
			// I think we can never get here. Let's make sure though
			throw new RiotApiException(RiotApiException.IOEXCEPTION);
		}
		if (response.getCode() == RequestResponse.CODE_SUCCESS_NOCONTENT) {
			// The Riot Api is fine with the request, and explicitly sends no content
			return null;
		}
		T dto = null;
		try {
			dto = new Gson().fromJson(response.getBody(), desiredDto);
		} catch (JsonSyntaxException e) {
			throw new RiotApiException(RiotApiException.PARSE_FAILURE);
		}
		if (dto == null) {
			throw new RiotApiException(RiotApiException.PARSE_FAILURE);
		}
		return dto;
	} 
                            #location 12 
                            #vulnerability type THREAD_SAFETY_VIOLATION
#fixed code
                             public <T> T getDto(Type desiredDto) throws RiotApiException, RateLimitException {
		requireSucceededRequestState();
		if (responseCode == CODE_SUCCESS_NOCONTENT) {
			// The Riot Api is fine with the request, and explicitly sends no content
			return null;
		}
		T dto = null;
		try {
			dto = new Gson().fromJson(responseBody, desiredDto);
		} catch (JsonSyntaxException e) {
			throw new RiotApiException(RiotApiException.PARSE_FAILURE);
		}
		if (dto == null) {
			throw new RiotApiException(RiotApiException.PARSE_FAILURE);
		}
		return dto;
	}