Last.fm: null checking
This commit is contained in:
parent
2de73adffe
commit
49c083d536
1 changed files with 2 additions and 0 deletions
|
|
@ -75,6 +75,8 @@ function sendRequest(activity: Activity) {
|
||||||
|
|
||||||
/** Fetches a Discord application's asset */
|
/** Fetches a Discord application's asset */
|
||||||
async function fetchAsset<T extends string | string[]>(asset: T, appId: string = Constants.APPLICATION_ID): Promise<T> {
|
async function fetchAsset<T extends string | string[]>(asset: T, appId: string = Constants.APPLICATION_ID): Promise<T> {
|
||||||
|
if (!asset) return null;
|
||||||
|
|
||||||
if (typeof asset === "string") {
|
if (typeof asset === "string") {
|
||||||
const assetId = await AssetManager.getAssetIds(appId, [asset]);
|
const assetId = await AssetManager.getAssetIds(appId, [asset]);
|
||||||
return assetId[0] as T;
|
return assetId[0] as T;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue