mirror of
https://github.com/duckietm/Nitro-V3.git
synced 2026-06-19 23:16:21 +00:00
🆙 Fix the catalog search in some cases it will give a black screen
This commit is contained in:
@@ -150,39 +150,34 @@ export class AvatarEditorThumbnailsHelper
|
||||
|
||||
if(cached) return cached;
|
||||
|
||||
const avatarImage = GetAvatarRenderManager().createAvatarImage(figureString, AvatarScaleType.LARGE, null, null);
|
||||
|
||||
if(avatarImage.isPlaceholder())
|
||||
return new Promise(async (resolve, reject) =>
|
||||
{
|
||||
avatarImage.dispose();
|
||||
const resetFigure = async (figure: string) =>
|
||||
{
|
||||
const avatarImage = GetAvatarRenderManager().createAvatarImage(figure, AvatarScaleType.LARGE, null, { resetFigure, dispose: null, disposed: false });
|
||||
|
||||
return null;
|
||||
}
|
||||
if(avatarImage.isPlaceholder()) return;
|
||||
|
||||
const texture = avatarImage.processAsTexture(AvatarSetType.HEAD, false);
|
||||
const texture = avatarImage.processAsTexture(AvatarSetType.HEAD, false);
|
||||
const sprite = new NitroSprite(texture);
|
||||
|
||||
if(!texture)
|
||||
{
|
||||
avatarImage.dispose();
|
||||
if(isDisabled) sprite.filters = [ AvatarEditorThumbnailsHelper.ALPHA_FILTER ];
|
||||
|
||||
return null;
|
||||
}
|
||||
const imageUrl = await TextureUtils.generateImageUrl({
|
||||
target: sprite,
|
||||
frame: new NitroRectangle(0, 0, texture.width, texture.height)
|
||||
});
|
||||
|
||||
const sprite = new NitroSprite(texture);
|
||||
sprite.destroy();
|
||||
avatarImage.dispose();
|
||||
|
||||
if(isDisabled) sprite.filters = [ AvatarEditorThumbnailsHelper.ALPHA_FILTER ];
|
||||
AvatarEditorThumbnailsHelper.THUMBNAIL_CACHE.set(thumbnailKey, imageUrl);
|
||||
|
||||
const imageUrl = await TextureUtils.generateImageUrl({
|
||||
target: sprite,
|
||||
frame: new NitroRectangle(0, 0, texture.width, texture.height)
|
||||
resolve(imageUrl);
|
||||
};
|
||||
|
||||
resetFigure(figureString);
|
||||
});
|
||||
|
||||
sprite.destroy();
|
||||
avatarImage.dispose();
|
||||
|
||||
if(imageUrl) AvatarEditorThumbnailsHelper.THUMBNAIL_CACHE.set(thumbnailKey, imageUrl);
|
||||
|
||||
return imageUrl;
|
||||
}
|
||||
|
||||
private static sortByDrawOrder(a: IFigurePart, b: IFigurePart): number
|
||||
|
||||
@@ -13,6 +13,8 @@ export const GetSubscriptionProductIcon = (id: number) =>
|
||||
|
||||
export const GetOfferNodes = (offerNodes: Map<number, ICatalogNode[]>, offerId: number) =>
|
||||
{
|
||||
if(!offerNodes) return [];
|
||||
|
||||
const nodes = offerNodes.get(offerId);
|
||||
const allowedNodes: ICatalogNode[] = [];
|
||||
|
||||
@@ -20,7 +22,7 @@ export const GetOfferNodes = (offerNodes: Map<number, ICatalogNode[]>, offerId:
|
||||
{
|
||||
for(const node of nodes)
|
||||
{
|
||||
if(!node.isVisible) continue;
|
||||
if(!node || !node.isVisible) continue;
|
||||
|
||||
allowedNodes.push(node);
|
||||
}
|
||||
@@ -31,6 +33,8 @@ export const GetOfferNodes = (offerNodes: Map<number, ICatalogNode[]>, offerId:
|
||||
|
||||
export const FilterCatalogNode = (search: string, furniLines: string[], node: ICatalogNode, nodes: ICatalogNode[]) =>
|
||||
{
|
||||
if(!node) return;
|
||||
|
||||
if(node.isVisible && (node.pageId > 0))
|
||||
{
|
||||
let nodeAdded = false;
|
||||
|
||||
@@ -105,12 +105,12 @@ export class FurnitureOffer implements IPurchasableOffer
|
||||
|
||||
public get localizationName(): string
|
||||
{
|
||||
return this._furniData.name;
|
||||
return this._furniData?.name ?? '';
|
||||
}
|
||||
|
||||
public get localizationDescription(): string
|
||||
{
|
||||
return this._furniData.description;
|
||||
return this._furniData?.description ?? '';
|
||||
}
|
||||
|
||||
public get isLazy(): boolean
|
||||
|
||||
Reference in New Issue
Block a user