Skip to content

Stack empty error with incorrect or missing verse numbers #363

@pmachapman

Description

@pmachapman

GetRows fails with the following error:

Message: 
System.InvalidOperationException : An error occurred while parsing the text 'MAT'. Verse: MAT 1:१, line: 6, character: 1, error: 'Stack empty.'
  ----> System.InvalidOperationException : Stack empty.

  Stack Trace: 
UsfmTextBase.GetVersesInDocOrder() line 75
ScriptureText.GetRows() line 21
UsfmMemoryTextTests.GetRows(String usfm, Boolean includeMarkers, Boolean includeAllText) line 460
UsfmMemoryTextTests.GetRows_VersePara_BeginningNonVerseSegment2() line 186
RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
--InvalidOperationException
Stack`1.ThrowForEmptyStack()
Stack`1.Pop()
ScriptureRefUsfmParserHandlerBase.NextElement(String marker) line 334
ScriptureRefUsfmParserHandlerBase.StartParentElement(String marker) line 340
ScriptureRefUsfmParserHandlerBase.EndPara(UsfmParserState state, String marker) line 136
UsfmParser.CloseElement(Boolean closed) line 639
UsfmParser.CloseAll() line 592
UsfmParser.ProcessToken() line 145
UsfmParser.ProcessTokens() line 133
UsfmTextBase.GetVersesInDocOrder() line 65

Given USFM with non-latin numbers:

\id MAT - Test
\c 1
\p
\v १
\p

Or when the \v tag is empty:

\id MAT - Test
\c 1
\p
\v
\b

What should probably happen is either the verse is ignored, or an error about the verse number being incorrect is thrown so that it can be corrected in the USFM.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    Status

    🔖 Ready

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions