# Buggy code
async def _skip_action(ctx):
    player = lavalink.get_player(ctx.guild.id)
    if not player.queue:
        pos, dur = player.position, player.current.length
        time_remain = lavalink.utils.format_time(dur - pos)
        if player.current.is_stream:
            embed = discord.Embed(
                colour=ctx.guild.me.top_role.colour,
                title="There's nothing in the queue.",
            )
            embed.set_footer(
                text="Currently livestreaming {}".format(player.current.title)
            )
        else:
            embed = discord.Embed(
                colour=ctx.guild.me.top_role.colour,
                title="There's nothing in the queue.",
            )
            embed.set_footer(
                text="{} left on {}".format(time_remain, player.current.title)
            )
        return await ctx.send(embed=embed)

    embed = discord.Embed(
        colour=ctx.guild.me.top_role.colour,
        title="Track Skipped",
        description="**[{}]({})**".format(player.current.title, player.current.uri),
    )
    await ctx.send(embed=embed)
    await player.skip()


# Traceback (AttributeError)
Exception in command 'skip'
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/discord/ext/commands/core.py", line 62, in wrapped
ret = yield from coro(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/redbot/cogs/audio/audio.py", line 1428, in skip
return await self._skip_action(ctx)
File "/usr/local/lib/python3.6/dist-packages/redbot/cogs/audio/audio.py", line 1492, in _skip_action
pos, dur = player.position, player.current.length
AttributeError: 'NoneType' object has no attribute 'length'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/discord/ext/commands/bot.py", line 886, in invoke
yield from ctx.command.invoke(ctx)
File "/usr/local/lib/python3.6/dist-packages/discord/ext/commands/core.py", line 514, in invoke
yield from injected(*ctx.args, **ctx.kwargs)
File "/usr/local/lib/python3.6/dist-packages/discord/ext/commands/core.py", line 71, in wrapped
raise CommandInvokeError(e) from e
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'length'

# Fixed code
async def _skip_action(self, ctx):
    player = lavalink.get_player(ctx.guild.id)
    if not player.queue:
        try:
            pos, dur = player.position, player.current.length
        except AttributeError:
            return await self._embed_msg(ctx, "There's nothing in the queue.")
        time_remain = lavalink.utils.format_time(dur - pos)
        if player.current.is_stream:
            embed = discord.Embed(
                colour=ctx.guild.me.top_role.colour,
                title="There's nothing in the queue.",
            )
            embed.set_footer(
                text="Currently livestreaming {}".format(player.current.title)
            )
        else:
            embed = discord.Embed(
                colour=ctx.guild.me.top_role.colour,
                title="There's nothing in the queue.",
            )
            embed.set_footer(
                text="{} left on {}".format(time_remain, player.current.title)
            )
        return await ctx.send(embed=embed)

    embed = discord.Embed(
        colour=ctx.guild.me.top_role.colour,
        title="Track Skipped",
        description="**[{}]({})**".format(player.current.title, player.current.uri),
    )
    await ctx.send(embed=embed)
    await player.skip()